Commit 72a14e82 authored by Liu Shixin's avatar Liu Shixin Committed by Andrew Morton

memcg: expose swapcache stat for memcg v1

Patch series "Expose swapcache stat for memcg v1", v2.

Since commit b6038942 ("mm: memcg: add swapcache stat for memcg v2")
adds swapcache stat for the cgroup v2, it seems there is no reason to hide
it in memcg v1.  Conversely, with swapcached it is more accurate to
evaluate the available memory for memcg.

Link: https://lkml.kernel.org/r/20230915105845.3199656-1-liushixin2@huawei.com
Link: https://lkml.kernel.org/r/20230915105845.3199656-2-liushixin2@huawei.comSigned-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Suggested-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: Michal Koutný <mkoutny@suse.com>
Cc: Zefan Li <lizefan.x@bytedance.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 55d2a0bd
...@@ -551,6 +551,7 @@ memory.stat file includes following statistics: ...@@ -551,6 +551,7 @@ memory.stat file includes following statistics:
event happens each time a page is unaccounted from the event happens each time a page is unaccounted from the
cgroup. cgroup.
swap # of bytes of swap usage 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. 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 writeback # of bytes of file/anon cache that are queued for syncing to
disk. disk.
......
...@@ -4068,7 +4068,10 @@ static const unsigned int memcg1_stats[] = { ...@@ -4068,7 +4068,10 @@ static const unsigned int memcg1_stats[] = {
NR_WRITEBACK, NR_WRITEBACK,
WORKINGSET_REFAULT_ANON, WORKINGSET_REFAULT_ANON,
WORKINGSET_REFAULT_FILE, WORKINGSET_REFAULT_FILE,
#ifdef CONFIG_SWAP
MEMCG_SWAP, MEMCG_SWAP,
NR_SWAPCACHE,
#endif
}; };
static const char *const memcg1_stat_names[] = { static const char *const memcg1_stat_names[] = {
...@@ -4083,7 +4086,10 @@ static const char *const memcg1_stat_names[] = { ...@@ -4083,7 +4086,10 @@ static const char *const memcg1_stat_names[] = {
"writeback", "writeback",
"workingset_refault_anon", "workingset_refault_anon",
"workingset_refault_file", "workingset_refault_file",
#ifdef CONFIG_SWAP
"swap", "swap",
"swapcached",
#endif
}; };
/* Universal VM events cgroup1 shows, original sort order */ /* Universal VM events cgroup1 shows, original sort order */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment