Commit 649fdc2c authored by Liu Shixin's avatar Liu Shixin
Browse files

memcg: remove unused do_memsw_account in memcg1_stat_format

mainline inclusion
from mainline-v6.7-rc1
commit 840ea53a8dec3aa5773f7957d4eaafdf925c664a
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8YTVI

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=840ea53a8dec3aa5773f7957d4eaafdf925c664a

--------------------------------

Since commit b25806dc("mm: memcontrol: deprecate swapaccounting=0
mode") do_memsw_account() is synonymous with
!cgroup_subsys_on_dfl(memory_cgrp_subsys), It always equals true in
memcg1_stat_format().  Remove the unused code.

Link: https://lkml.kernel.org/r/20230915105845.3199656-3-liushixin2@huawei.com


Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Suggested-by: default avatarMichal Koutný <mkoutny@suse.com>
Reviewed-by: default avatarYosry Ahmed <yosryahmed@google.com>
Acked-by: default avatarTejun heo <tj@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Zefan Li <lizefan.x@bytedance.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent a55e054c
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -4750,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]));
@@ -4774,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]));