mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
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>
This commit is contained in:
parent
131adcc774
commit
7404bd37cf
|
|
@ -352,6 +352,7 @@ extern void swap_setup(void);
|
|||
extern unsigned long zone_reclaimable_pages(struct zone *zone);
|
||||
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
|
||||
gfp_t gfp_mask, nodemask_t *mask);
|
||||
unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx);
|
||||
|
||||
#define MEMCG_RECLAIM_MAY_SWAP (1 << 1)
|
||||
#define MEMCG_RECLAIM_PROACTIVE (1 << 2)
|
||||
|
|
|
|||
|
|
@ -390,8 +390,7 @@ unsigned long zone_reclaimable_pages(struct zone *zone)
|
|||
* @lru: lru to use
|
||||
* @zone_idx: zones to consider (use MAX_NR_ZONES - 1 for the whole LRU list)
|
||||
*/
|
||||
static unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru,
|
||||
int zone_idx)
|
||||
unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx)
|
||||
{
|
||||
unsigned long size = 0;
|
||||
int zid;
|
||||
|
|
|
|||
|
|
@ -691,9 +691,10 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker,
|
|||
|
||||
mem_cgroup_flush_stats_ratelimited(sc->memcg);
|
||||
lruvec = mem_cgroup_lruvec(sc->memcg, NODE_DATA(sc->nid));
|
||||
|
||||
for (pages = 0, i = 0; i < NR_LRU_LISTS; i++)
|
||||
pages += lruvec_page_state_local(lruvec,
|
||||
NR_LRU_BASE + i);
|
||||
pages += lruvec_lru_size(lruvec, i, MAX_NR_ZONES - 1);
|
||||
|
||||
pages += lruvec_page_state_local(
|
||||
lruvec, NR_SLAB_RECLAIMABLE_B) >> PAGE_SHIFT;
|
||||
pages += lruvec_page_state_local(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user