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

Configure Feed

Select the types of activity you want to include in your feed.

mm: workingset: use lruvec_lru_size() to get the number of lru pages

For cgroup v2, count_shadow_nodes() is the only place to read
non-hierarchical stats (lruvec_stats->state_local). To avoid the need to
consider cgroup v2 during subsequent non-hierarchical stats reparenting,
use lruvec_lru_size() instead of lruvec_page_state_local() to get the
number of lru pages.

For NR_SLAB_RECLAIMABLE_B and NR_SLAB_UNRECLAIMABLE_B cases, it appears
that the statistics here have already been problematic for a while since
slab pages have been reparented. So just ignore it for now.

Link: https://lore.kernel.org/b1d448c667a8fb377c3390d9aba43bdb7e4d5739.1772711148.git.zhengqi.arch@bytedance.com
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Muchun Song <muchun.song@linux.dev>
Cc: Allen Pais <apais@linux.microsoft.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Chen Ridong <chenridong@huawei.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Imran Khan <imran.f.khan@oracle.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam Howlett <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michal Koutný <mkoutny@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Usama Arif <usamaarif642@gmail.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yosry Ahmed <yosry@kernel.org>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Qi Zheng and committed by
Andrew Morton
7404bd37 131adcc7

+5 -4
+1
include/linux/swap.h
··· 352 352 extern unsigned long zone_reclaimable_pages(struct zone *zone); 353 353 extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 354 354 gfp_t gfp_mask, nodemask_t *mask); 355 + unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx); 355 356 356 357 #define MEMCG_RECLAIM_MAY_SWAP (1 << 1) 357 358 #define MEMCG_RECLAIM_PROACTIVE (1 << 2)
+1 -2
mm/vmscan.c
··· 390 390 * @lru: lru to use 391 391 * @zone_idx: zones to consider (use MAX_NR_ZONES - 1 for the whole LRU list) 392 392 */ 393 - static unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, 394 - int zone_idx) 393 + unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) 395 394 { 396 395 unsigned long size = 0; 397 396 int zid;
+3 -2
mm/workingset.c
··· 691 691 692 692 mem_cgroup_flush_stats_ratelimited(sc->memcg); 693 693 lruvec = mem_cgroup_lruvec(sc->memcg, NODE_DATA(sc->nid)); 694 + 694 695 for (pages = 0, i = 0; i < NR_LRU_LISTS; i++) 695 - pages += lruvec_page_state_local(lruvec, 696 - NR_LRU_BASE + i); 696 + pages += lruvec_lru_size(lruvec, i, MAX_NR_ZONES - 1); 697 + 697 698 pages += lruvec_page_state_local( 698 699 lruvec, NR_SLAB_RECLAIMABLE_B) >> PAGE_SHIFT; 699 700 pages += lruvec_page_state_local(