Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: memcg: add per-memcg zswap writeback stat

Since zswap now writes back pages from memcg-specific LRUs, we now need a
new stat to show writebacks count for each memcg.

[nphamcs@gmail.com: rename ZSWP_WB to ZSWPWB]
Link: https://lkml.kernel.org/r/20231205193307.2432803-1-nphamcs@gmail.com
Link: https://lkml.kernel.org/r/20231130194023.4102148-5-nphamcs@gmail.com
Suggested-by: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Signed-off-by: Nhat Pham <nphamcs@gmail.com>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Domenico Cerasuolo and committed by
Andrew Morton
7108cc3f a65b0e76

+7
+1
include/linux/vm_event_item.h
··· 142 142 #ifdef CONFIG_ZSWAP 143 143 ZSWPIN, 144 144 ZSWPOUT, 145 + ZSWPWB, 145 146 #endif 146 147 #ifdef CONFIG_X86 147 148 DIRECT_MAP_LEVEL2_SPLIT,
+1
mm/memcontrol.c
··· 703 703 #if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) 704 704 ZSWPIN, 705 705 ZSWPOUT, 706 + ZSWPWB, 706 707 #endif 707 708 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 708 709 THP_FAULT_ALLOC,
+1
mm/vmstat.c
··· 1401 1401 #ifdef CONFIG_ZSWAP 1402 1402 "zswpin", 1403 1403 "zswpout", 1404 + "zswpwb", 1404 1405 #endif 1405 1406 #ifdef CONFIG_X86 1406 1407 "direct_map_level2_splits",
+4
mm/zswap.c
··· 760 760 } 761 761 zswap_written_back_pages++; 762 762 763 + if (entry->objcg) 764 + count_objcg_event(entry->objcg, ZSWPWB); 765 + 766 + count_vm_event(ZSWPWB); 763 767 /* 764 768 * Writeback started successfully, the page now belongs to the 765 769 * swapcache. Drop the entry from zswap - unless invalidate already