Unverified Commit 29efdd23 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4200 Expose swapcache stat for memcg v1

Merge Pull Request from: @ci-robot 
 
PR sync from: Liu Shixin <liushixin2@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/E6OQAD7REQRYTR47EUAZ6Z4ETFLUMULY/ 
The first patch expose swapcache stat for memcg v1, the second patch
remote unused do_memsw_account() in memcg1_stat_format().

Liu Shixin (2):
  memcg: expose swapcache stat for memcg v1
  memcg: remove unused do_memsw_account in memcg1_stat_format


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I8YTVI 
 
Link:https://gitee.com/openeuler/kernel/pulls/4200

 

Reviewed-by: default avatarLu Jialin <lujialin4@huawei.com>
Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents d423f0b8 649fdc2c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -556,6 +556,7 @@ memory.stat file includes following statistics:
                    event happens each time a page is unaccounted from the
                    cgroup.
    swap            # of bytes of swap usage
    swapcached      # of bytes of swap cached in memory
    dirty           # of bytes that are waiting to get written back to the disk.
    writeback       # of bytes of file/anon cache that are queued for syncing to
                    disk.
+8 −7
Original line number Diff line number Diff line
@@ -4705,7 +4705,10 @@ static const unsigned int memcg1_stats[] = {
	NR_WRITEBACK,
	WORKINGSET_REFAULT_ANON,
	WORKINGSET_REFAULT_FILE,
#ifdef CONFIG_SWAP
	MEMCG_SWAP,
	NR_SWAPCACHE,
#endif
};

static const char *const memcg1_stat_names[] = {
@@ -4720,7 +4723,10 @@ static const char *const memcg1_stat_names[] = {
	"writeback",
	"workingset_refault_anon",
	"workingset_refault_file",
#ifdef CONFIG_SWAP
	"swap",
	"swapcached",
#endif
};

/* Universal VM events cgroup1 shows, original sort order */
@@ -4744,8 +4750,6 @@ static void memcg1_stat_format(struct mem_cgroup *memcg, struct seq_buf *s)
	for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) {
		unsigned long nr;

		if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
			continue;
		nr = memcg_page_state_local(memcg, memcg1_stats[i]);
		seq_buf_printf(s, "%s %lu\n", memcg1_stat_names[i],
			   nr * memcg_page_state_unit(memcg1_stats[i]));
@@ -4768,15 +4772,12 @@ static void memcg1_stat_format(struct mem_cgroup *memcg, struct seq_buf *s)
	}
	seq_buf_printf(s, "hierarchical_memory_limit %llu\n",
		       (u64)memory * PAGE_SIZE);
	if (do_memsw_account())
	seq_buf_printf(s, "hierarchical_memsw_limit %llu\n",
		       (u64)memsw * PAGE_SIZE);

	for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) {
		unsigned long nr;

		if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
			continue;
		nr = memcg_page_state(memcg, memcg1_stats[i]);
		seq_buf_printf(s, "total_%s %llu\n", memcg1_stat_names[i],
			   (u64)nr * memcg_page_state_unit(memcg1_stats[i]));