From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCFB4C369D5 for ; Thu, 24 Apr 2025 20:28:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92A636B00A3; Thu, 24 Apr 2025 16:28:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B8646B00A5; Thu, 24 Apr 2025 16:28:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B8886B00A7; Thu, 24 Apr 2025 16:28:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 41DBF6B00A3 for ; Thu, 24 Apr 2025 16:28:15 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 71E65161D10 for ; Thu, 24 Apr 2025 20:28:16 +0000 (UTC) X-FDA: 83370074592.01.148C4FE Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf23.hostedemail.com (Postfix) with ESMTP id A302C140002 for ; Thu, 24 Apr 2025 20:28:14 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=EJy13a0v; dmarc=none; spf=pass (imf23.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.179 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745526494; a=rsa-sha256; cv=none; b=CGbCw+PcppTjF2Ok2Xs3T1G/XdPe9YzAqYv6kRz6aXA1oACc1nkKtyyv8lg/40ekQPFvXv EPbnzRuVVYLVEL4AF7B2d60yrZlLlfXwQAVJIKKLtQihTAGusgZ3fteVHNMj/75nZC+7dC jVwh70u1C/uHRF8B6I9VmiX40nshtL4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=EJy13a0v; dmarc=none; spf=pass (imf23.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.179 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745526494; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CxWEnn5MTFE6+1tVKFs4oJ/SdesKMia6cc2bPiHfnm4=; b=pM5lgUKcX7P89fcLdqOCrzlvN6WCHnLVHrmpPnl3B0xhkQoNpfSEilAXfbq6ggijUHmjcv zCBEfbTb5MOpS0q+uzaWwWY7Qk5Xf6+RIYhIY4n8eBJZxtg9egKEz98xHzhyAJK99Ihnxm wwCozWRZSQCuDKFIphgCnlWHMUM+i2M= Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-47686580529so17112481cf.2 for ; Thu, 24 Apr 2025 13:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1745526493; x=1746131293; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CxWEnn5MTFE6+1tVKFs4oJ/SdesKMia6cc2bPiHfnm4=; b=EJy13a0v02WYgrOGN+xCVbLAmUxJ33iTbGEeYPQyMyMXzzJVsSg/E2BRU4t1RwVDdV N8HNbSz/9ppDQt2vv8TdtXqVg3m/4ZTyEpZdptZ5IjAJSrNB/ap5IuAFSIti2YaZ9KqH K1JupxF6RZRTRygXu3yGHb5hRzYDs29UMuoliZDKYbq9cehuHnk4szzb7q4ICjUxSYMV FydrFop4CiTPFBPtxdOVOiYPGWAekwdWODzuLipEGjS+g6FMd9WhL2MuLlJWLCO/MARn KXImFbdZpHzxW1z2EY/YfIjE5T0feYRqFsLB/GwWY3qwdmlKjibljwrXXdA9ghCP2Mqo rrzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745526493; x=1746131293; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CxWEnn5MTFE6+1tVKFs4oJ/SdesKMia6cc2bPiHfnm4=; b=bIyKUBHP0A/uxkaRe5IP2YEKwXS8mgy5uCAWU/o7xQIL1pXyIMq/HlQTf5pmzRT3WL 3sO2k/WtMO11EE5S4VUS/bWqvgFsIQiqBiofnr8k4qIcfXZVTzePqf++0c6VN7le4cJ/ ZvwTihIcgO+8opGf1y2ClyIwh7rFZTTC7Rqg1DoEHSaofzBC44gyO3ouer1dakSbU3TV DeeiTuFjwyrFtGL8frNFEqmEo1y9tYimLLmceRLvOor2dpx2hTBPuvoAVA0wnjv0bvQ+ 5mAw0mwqru5eEcZqQdieKYUYLHAE+eSO6sr64pCkU9OqZZgoK1ZA7DAhBL6KtkvjLGUM jAnw== X-Gm-Message-State: AOJu0YyX7zmEmNoFj7A/LnH94XLvXseHtGXOl9jXafLMGgJ7zNBM20ld C4BvUEztfFHqo0t4v0mPITIIl19GeFjER0NP/XRzRumG/JJNOzn86C2Daoub8V4ScyHpwBbViEy S X-Gm-Gg: ASbGncvSbVNv+XkiWO2O8bCf1euvUTC8vRR4U52DSkPUvwnawy8m/kjWOAhYuxj5mVB y2/41a46vUgIwQugrL7A/UamJ/raVTGbA90IqvnTPSbY/wOnBMBFQ51NHNPp01iuxIpFRbJpge4 xVk69TJ4qMBailohY4T6S4B2s7cHhccfHsj5x7IPtUUNUCNrmOmWLx/5b4H4cuapQC46SJilWgu 7vSSx0JSVKJO1cGak8MJ3p+4lOkBC8B3NwkWvL93fVOuTCMECTp01IfrTXJ8dgd8wFaUNjZzH2K Wk8D6qRbb/Q+ChIa16+DOnwUOnKUmm+QN7bULV0jP56fW35+Y/tFkagezrsChAVK5a/CaeQtLCE R187TbWWot6Wo/Ah+YfPaISp3e9apCCViN/sIovg= X-Google-Smtp-Source: AGHT+IHogOSfTg5LJdUBkMbpkPdMOCaNUDFPxTL0UeOXpsUsIFBmyFi+0UOFbb/jmohzrTYiFE7SSQ== X-Received: by 2002:ac8:7d44:0:b0:47f:9f87:ce0a with SMTP id d75a77b69052e-47fb68d7bf9mr14855211cf.0.1745526493434; Thu, 24 Apr 2025 13:28:13 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F.lan (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-47e9ebeb870sm16091691cf.5.2025.04.24.13.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Apr 2025 13:28:13 -0700 (PDT) From: Gregory Price To: linux-mm@kvack.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, longman@redhat.com, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeel.butt@linux.dev, muchun.song@linux.dev, tj@kernel.org, mkoutny@suse.com, akpm@linux-foundation.org Subject: [PATCH v5 2/2] vmscan,cgroup: apply mems_effective to reclaim Date: Thu, 24 Apr 2025 16:28:06 -0400 Message-ID: <20250424202806.52632-3-gourry@gourry.net> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424202806.52632-1-gourry@gourry.net> References: <20250424202806.52632-1-gourry@gourry.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A302C140002 X-Stat-Signature: gcp1qdipsb9d63gxfu67r1s4xomiph7j X-HE-Tag: 1745526494-385470 X-HE-Meta: U2FsdGVkX1+WvdtJ3g8SR7VG3sNR0EK/emiwioJvM0ol677d/IFkaIh6+k6XUasvC0yTkuzTXN4znt35F6vCg1m1dFKrnO7/i//t1Ru/GxVZudxEsciLOJgv8HQeCKiRO9e53L97AsgsYfR0fYK1Arti/bQhcAwCFdU1zwZK7Nrv7ZSIIOhawYSbpG5rFfajYp3JdA752IKZLgEK7ngBBCxNQVYDYcsXUkLRXaB/J7foCxRo8ReIyY7ZaEN53mGO2UsaAl13IqANxdr61ulmjcoDbcx6KhdEye9VAWzAXCNPEjkZopQ4CjgC3vJdXNOuMRWM9d7rU0WdbSI1kwFonh6t9NKOBYmcCmYOFaQEhojqk+yFgUPBoMBVXNiX4l6K3BCJRn7yxdcK3BMs32uElNSkvWD82s+CDKwECV2jyQ6JKmICSpSSVcwI+vw3IXNJ1oFXZN2NBfdu4vmOw91TW9NN2BjjIqnQqUDn8XyPHunWVE+dsLLkZFiEpwp5oeW/Hm283e/cMf5ITKQ9fTC/Uwl97tLwwCGWJN/5t1xR1/gEROULGpi0ID3BMXwvCxIpXs+BhGJwejd19Uuty6eM8zDmohd6F4/2V4Xv/lEO4gE8WWI0nbSSYaHjYe4Mk+/q3Mw4Q4wPUc38Awd+Mafmpm3DaLz+NpO2wxNeXkCG+JlVYi/hyrAZbassESPlZFcT0z0Iuqz8tOu78nPNZHWjpcNeAK8fKW+mI/YMKJ+R6Qcee8WtvfUGzcmeGGhC/k2g/UElLzOP5lVPC/y/4JwhoDwUgJ0uvLRv30Ss9+TMDvvszpDLPCE+U69yuzTaIJa1e4cXzXF00uTbt1RiQJKaER6ZaNoGyM7K9uiPuljA2Hl7s7Oo87sSNhMvFKWULH6f8w1Ig6boEcMioXCYWutlMaqk3ctlAvK4VOiIgwMOv+moEBlCl4iX/q3rr/5suKal9HCgRpQwz6aWJHKtyUS nh52979e OEppiZlwMi9B5JJvDGtOlE3+AyVNXFgdoJMA+JhDdbcZjMb09BVdmIrUe53qiWYRcnIZSrSob6Hu1rcaHDSUhB5LMDWM6wgh11BUsYhtpP4r+UTpOSsoxKQ9O+m+qv3Vyk53aaGmlOkFuFQpeziwIBpJpaIgH6QZQz/GBKqg59w8K/oAOnlsMNY1aRAZi9N8Me0m44G14CsTT6JlCjdrB1CXLXdgpLFYs2EjfoDo4H/xaCIgenYAn3xv14O/tWqMfXB1tO6GanNWcsLou/cxrHJRsmOIgX/v0y9iwUV3Ee/ycCaF0xnHKVARl9RwquE5O2G3RBlqfoR67zozvR0HAQQGBC/LMCilPTCAY91X28cKBIAq0Mw0ZF/sjiRFmRSCrNjdwmNemSOr3JCHTgPsv+4948sZQl1kI//yP9JNJ988yx8iPFMV07c7dOlBcqPW9KwggjiD+K+762uk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It is possible for a reclaimer to cause demotions of an lruvec belonging to a cgroup with cpuset.mems set to exclude some nodes. Attempt to apply this limitation based on the lruvec's memcg and prevent demotion. Notably, this may still allow demotion of shared libraries or any memory first instantiated in another cgroup. This means cpusets still cannot cannot guarantee complete isolation when demotion is enabled, and the docs have been updated to reflect this. This is useful for isolating workloads on a multi-tenant system from certain classes of memory more consistently - with the noted exceptions. Note on locking: The cgroup_get_e_css reference protects the css->effective_mems, and calls of this interface would be subject to the same race conditions associated with a non-atomic access to cs->effective_mems. So while this interface cannot make strong guarantees of correctness, it can therefore avoid taking a global or rcu_read_lock for performance. Suggested-by: Shakeel Butt Suggested-by: Waiman Long Acked-by: Tejun Heo Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt Reviewed-by: Waiman Long Signed-off-by: Gregory Price --- .../ABI/testing/sysfs-kernel-mm-numa | 16 +++++--- include/linux/cpuset.h | 5 +++ include/linux/memcontrol.h | 6 +++ kernel/cgroup/cpuset.c | 36 ++++++++++++++++ mm/memcontrol.c | 6 +++ mm/vmscan.c | 41 +++++++++++-------- 6 files changed, 88 insertions(+), 22 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-numa b/Documentation/ABI/testing/sysfs-kernel-mm-numa index 77e559d4ed80..90e375ff54cb 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-numa +++ b/Documentation/ABI/testing/sysfs-kernel-mm-numa @@ -16,9 +16,13 @@ Description: Enable/disable demoting pages during reclaim Allowing page migration during reclaim enables these systems to migrate pages from fast tiers to slow tiers when the fast tier is under pressure. This migration - is performed before swap. It may move data to a NUMA - node that does not fall into the cpuset of the - allocating process which might be construed to violate - the guarantees of cpusets. This should not be enabled - on systems which need strict cpuset location - guarantees. + is performed before swap if an eligible numa node is + present in cpuset.mems for the cgroup (or if cpuset v1 + is being used). If cpusets.mems changes at runtime, it + may move data to a NUMA node that does not fall into the + cpuset of the new cpusets.mems, which might be construed + to violate the guarantees of cpusets. Shared memory, + such as libraries, owned by another cgroup may still be + demoted and result in memory use on a node not present + in cpusets.mem. This should not be enabled on systems + which need strict cpuset location guarantees. diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 893a4c340d48..5255e3fdbf62 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -171,6 +171,7 @@ static inline void set_mems_allowed(nodemask_t nodemask) task_unlock(current); } +extern bool cpuset_node_allowed(struct cgroup *cgroup, int nid); #else /* !CONFIG_CPUSETS */ static inline bool cpusets_enabled(void) { return false; } @@ -282,6 +283,10 @@ static inline bool read_mems_allowed_retry(unsigned int seq) return false; } +static inline bool cpuset_node_allowed(struct cgroup *cgroup, int nid) +{ + return true; +} #endif /* !CONFIG_CPUSETS */ #endif /* _LINUX_CPUSET_H */ diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 53364526d877..a6c4e3faf721 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1736,6 +1736,8 @@ static inline void count_objcg_events(struct obj_cgroup *objcg, rcu_read_unlock(); } +bool mem_cgroup_node_allowed(struct mem_cgroup *memcg, int nid); + #else static inline bool mem_cgroup_kmem_disabled(void) { @@ -1793,6 +1795,10 @@ static inline void count_objcg_events(struct obj_cgroup *objcg, { } +static inline bool mem_cgroup_node_allowed(struct mem_cgroup *memcg, int nid) +{ + return true; +} #endif /* CONFIG_MEMCG */ #if defined(CONFIG_MEMCG) && defined(CONFIG_ZSWAP) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index f8e6a9b642cb..7eb71d411dc7 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -4163,6 +4163,42 @@ bool cpuset_current_node_allowed(int node, gfp_t gfp_mask) return allowed; } +bool cpuset_node_allowed(struct cgroup *cgroup, int nid) +{ + struct cgroup_subsys_state *css; + struct cpuset *cs; + bool allowed; + + /* + * In v1, mem_cgroup and cpuset are unlikely in the same hierarchy + * and mems_allowed is likely to be empty even if we could get to it, + * so return true to avoid taking a global lock on the empty check. + */ + if (!cpuset_v2()) + return true; + + css = cgroup_get_e_css(cgroup, &cpuset_cgrp_subsys); + if (!css) + return true; + + /* + * Normally, accessing effective_mems would require the cpuset_mutex + * or callback_lock - but node_isset is atomic and the reference + * taken via cgroup_get_e_css is sufficient to protect css. + * + * Since this interface is intended for use by migration paths, we + * relax locking here to avoid taking global locks - while accepting + * there may be rare scenarios where the result may be innaccurate. + * + * Reclaim and migration are subject to these same race conditions, and + * cannot make strong isolation guarantees, so this is acceptable. + */ + cs = container_of(css, struct cpuset, css); + allowed = node_isset(nid, cs->effective_mems); + css_put(css); + return allowed; +} + /** * cpuset_spread_node() - On which node to begin search for a page * @rotor: round robin rotor diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 40c07b8699ae..2f61d0060fd1 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -5437,3 +5438,8 @@ static int __init mem_cgroup_swap_init(void) subsys_initcall(mem_cgroup_swap_init); #endif /* CONFIG_SWAP */ + +bool mem_cgroup_node_allowed(struct mem_cgroup *memcg, int nid) +{ + return memcg ? cpuset_node_allowed(memcg->css.cgroup, nid) : true; +} diff --git a/mm/vmscan.c b/mm/vmscan.c index 2b2ab386cab5..32a7ce421e42 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -342,16 +342,22 @@ static void flush_reclaim_state(struct scan_control *sc) } } -static bool can_demote(int nid, struct scan_control *sc) +static bool can_demote(int nid, struct scan_control *sc, + struct mem_cgroup *memcg) { + int demotion_nid; + if (!numa_demotion_enabled) return false; if (sc && sc->no_demotion) return false; - if (next_demotion_node(nid) == NUMA_NO_NODE) + + demotion_nid = next_demotion_node(nid); + if (demotion_nid == NUMA_NO_NODE) return false; - return true; + /* If demotion node isn't in the cgroup's mems_allowed, fall back */ + return mem_cgroup_node_allowed(memcg, demotion_nid); } static inline bool can_reclaim_anon_pages(struct mem_cgroup *memcg, @@ -376,7 +382,7 @@ static inline bool can_reclaim_anon_pages(struct mem_cgroup *memcg, * * Can it be reclaimed from this node via demotion? */ - return can_demote(nid, sc); + return can_demote(nid, sc, memcg); } /* @@ -1096,7 +1102,8 @@ static bool may_enter_fs(struct folio *folio, gfp_t gfp_mask) */ static unsigned int shrink_folio_list(struct list_head *folio_list, struct pglist_data *pgdat, struct scan_control *sc, - struct reclaim_stat *stat, bool ignore_references) + struct reclaim_stat *stat, bool ignore_references, + struct mem_cgroup *memcg) { struct folio_batch free_folios; LIST_HEAD(ret_folios); @@ -1109,7 +1116,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, folio_batch_init(&free_folios); memset(stat, 0, sizeof(*stat)); cond_resched(); - do_demote_pass = can_demote(pgdat->node_id, sc); + do_demote_pass = can_demote(pgdat->node_id, sc, memcg); retry: while (!list_empty(folio_list)) { @@ -1658,7 +1665,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone, */ noreclaim_flag = memalloc_noreclaim_save(); nr_reclaimed = shrink_folio_list(&clean_folios, zone->zone_pgdat, &sc, - &stat, true); + &stat, true, NULL); memalloc_noreclaim_restore(noreclaim_flag); list_splice(&clean_folios, folio_list); @@ -2031,7 +2038,8 @@ static unsigned long shrink_inactive_list(unsigned long nr_to_scan, if (nr_taken == 0) return 0; - nr_reclaimed = shrink_folio_list(&folio_list, pgdat, sc, &stat, false); + nr_reclaimed = shrink_folio_list(&folio_list, pgdat, sc, &stat, false, + lruvec_memcg(lruvec)); spin_lock_irq(&lruvec->lru_lock); move_folios_to_lru(lruvec, &folio_list); @@ -2214,7 +2222,7 @@ static unsigned int reclaim_folio_list(struct list_head *folio_list, .no_demotion = 1, }; - nr_reclaimed = shrink_folio_list(folio_list, pgdat, &sc, &stat, true); + nr_reclaimed = shrink_folio_list(folio_list, pgdat, &sc, &stat, true, NULL); while (!list_empty(folio_list)) { folio = lru_to_folio(folio_list); list_del(&folio->lru); @@ -2646,7 +2654,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, * Anonymous LRU management is a waste if there is * ultimately no way to reclaim the memory. */ -static bool can_age_anon_pages(struct pglist_data *pgdat, +static bool can_age_anon_pages(struct lruvec *lruvec, struct scan_control *sc) { /* Aging the anon LRU is valuable if swap is present: */ @@ -2654,7 +2662,8 @@ static bool can_age_anon_pages(struct pglist_data *pgdat, return true; /* Also valuable if anon pages can be demoted: */ - return can_demote(pgdat->node_id, sc); + return can_demote(lruvec_pgdat(lruvec)->node_id, sc, + lruvec_memcg(lruvec)); } #ifdef CONFIG_LRU_GEN @@ -2732,7 +2741,7 @@ static int get_swappiness(struct lruvec *lruvec, struct scan_control *sc) if (!sc->may_swap) return 0; - if (!can_demote(pgdat->node_id, sc) && + if (!can_demote(pgdat->node_id, sc, memcg) && mem_cgroup_get_nr_swap_pages(memcg) < MIN_LRU_BATCH) return 0; @@ -4695,7 +4704,7 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap if (list_empty(&list)) return scanned; retry: - reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false); + reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false, memcg); sc->nr.unqueued_dirty += stat.nr_unqueued_dirty; sc->nr_reclaimed += reclaimed; trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id, @@ -5850,7 +5859,7 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) * Even if we did not try to evict anon pages at all, we want to * rebalance the anon lru active/inactive ratio. */ - if (can_age_anon_pages(lruvec_pgdat(lruvec), sc) && + if (can_age_anon_pages(lruvec, sc) && inactive_is_low(lruvec, LRU_INACTIVE_ANON)) shrink_active_list(SWAP_CLUSTER_MAX, lruvec, sc, LRU_ACTIVE_ANON); @@ -6681,10 +6690,10 @@ static void kswapd_age_node(struct pglist_data *pgdat, struct scan_control *sc) return; } - if (!can_age_anon_pages(pgdat, sc)) + lruvec = mem_cgroup_lruvec(NULL, pgdat); + if (!can_age_anon_pages(lruvec, sc)) return; - lruvec = mem_cgroup_lruvec(NULL, pgdat); if (!inactive_is_low(lruvec, LRU_INACTIVE_ANON)) return; -- 2.49.0