Skip to content

Commit

Permalink
memcg: remove unused do_memsw_account in memcg1_stat_format
Browse files Browse the repository at this point in the history
Since commit b25806d("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/[email protected]
Signed-off-by: Liu Shixin <[email protected]>
Suggested-by: Michal Koutný <[email protected]>
Reviewed-by: Yosry Ahmed <[email protected]>
Acked-by: Tejun heo <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Zefan Li <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Liu Shixin authored and akpm00 committed Oct 6, 2023
1 parent 72a14e8 commit 840ea53
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -4113,8 +4113,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]));
Expand All @@ -4137,15 +4135,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);
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]));
Expand Down

0 comments on commit 840ea53

Please sign in to comment.