From: sashiko-bot@kernel.org
To: "Kanchana P. Sridhar" <kanchanapsridhar2026@gmail.com>,
hannes@cmpxchg.org, yosry@kernel.org, nphamcs@gmail.com,
chengming.zhou@linux.dev, akpm@linux-foundation.org,
linux-mm@kvack.org, herbert@gondor.apana.org.au,
davem@davemloft.net, linux-crypto@vger.kernel.org
Cc: rientjes@google.com, willy@infradead.org, senozhatsky@chromium.org
Subject: Re: [PATCH v4 5/8] mm: zswap: Store the folio's node id in the zswap_entry.
Date: Sat, 21 Nov 2026 04:20:05 +0000 [thread overview]
Message-ID: <sashiko-outbox-226635@kernel.org> (raw)
In-Reply-To: <20261120041906.5785-6-kanchanapsridhar2026@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm: zswap: shrink_memcg() skips non-N_NORMAL_MEMORY nodes in
zswap_list_lru
--
commit e4e47a21782dc39867fe81289fb7e9ed7f2692b4
Author: Kanchana P. Sridhar <kanchanapsridhar2026@gmail.com>
mm: zswap: Store the folio's node id in the zswap_entry.
This commit stores the folio's NUMA node ID in struct zswap_entry and uses
it when adding and removing entries on zswap_list_lru, instead of deriving
the node ID from the slab page backing the zswap_entry.
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 9a323862bd59d..78d9694f75b5e 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
[ ... ]
> @@ -680,14 +685,8 @@ static int zswap_enabled_param_set(const char *val,
> * lru functions
> **********************************/
>
> -static inline int entry_to_nid(struct zswap_entry *entry)
> -{
> - return page_to_nid(virt_to_page(entry));
> -}
> -
> static void zswap_lru_add(struct zswap_entry *entry)
> {
> - int nid = entry_to_nid(entry);
> struct mem_cgroup *memcg;
>
> /*
> @@ -704,19 +703,18 @@ static void zswap_lru_add(struct zswap_entry *entry)
> rcu_read_lock();
> memcg = obj_cgroup_memcg(entry->objcg);
> /* will always succeed */
> - list_lru_add(&zswap_list_lru, &entry->lru, nid, memcg);
> + list_lru_add(&zswap_list_lru, &entry->lru, entry->nid, memcg);
> rcu_read_unlock();
> }
[ ... ]
> @@ -1537,9 +1536,10 @@ static bool zswap_store_page(struct folio *folio, long index,
> {
> swp_entry_t page_swpentry = folio_swap_entry(folio, index);
> struct zswap_entry *entry, *old;
> + int nid = folio_nid(folio);
>
> /* allocate entry */
> - entry = zswap_entry_cache_alloc(GFP_KERNEL, folio_nid(folio));
> + entry = zswap_entry_cache_alloc(GFP_KERNEL);
> if (!entry) {
> zswap_reject_kmemcache_fail++;
> return false;
> @@ -1554,6 +1554,7 @@ static bool zswap_store_page(struct folio *folio, long index,
> * to an unrelated live pool.
> */
> entry->pool_idx = pool->idx;
> + entry->nid = nid;
[Severity: Medium]
Can shrink_memcg() miss zswap_list_lru entries when a folio resides on a
node outside N_NORMAL_MEMORY, such as a ZONE_MOVABLE-only CXL or
hotplugged memory node?
Previously, entry_to_nid() took the node ID from the GFP_KERNEL slab page
backing struct zswap_entry, which was always in N_NORMAL_MEMORY. Now
entry->nid is folio_nid(folio), which for GFP_HIGHUSER_MOVABLE folios can
be any node in N_MEMORY, while shrink_memcg() only walks
N_NORMAL_MEMORY:
mm/zswap.c:shrink_memcg() {
...
for_each_node_state(nid, N_NORMAL_MEMORY) {
unsigned long nr_to_walk = SWAP_CLUSTER_MAX;
shrunk += list_lru_walk_one(&zswap_list_lru, nid, memcg,
&shrink_memcg_cb, &ctl, &nr_to_walk);
scanned += SWAP_CLUSTER_MAX - nr_to_walk;
}
...
}
Entries stored from non-N_NORMAL_MEMORY nodes will never be scanned or
written back by synchronous cgroup limit reclaim or shrink_worker().
Should shrink_memcg() iterate over N_MEMORY instead?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120041906.5785-1-kanchanapsridhar2026@gmail.com?part=5
next prev parent reply other threads:[~2026-11-21 4:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 4:18 [PATCH v4 0/8] Batched zswap_store() framework with compression batching Kanchana P. Sridhar
2026-11-20 4:18 ` [PATCH v4 1/8] crypto: acomp - Define a unit_size in struct acomp_req to enable batching. mm: zswap: Set the unit size for zswap to PAGE_SIZE Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 2/8] crypto: acomp - Add bit to indicate segmentation support Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 3/8] crypto: acomp - Add trivial segmentation wrapper Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 4/8] crypto: acomp - Add API to get a compression algorithm's batch-size Kanchana P. Sridhar
2026-11-21 4:20 ` sashiko-bot
2026-11-20 4:19 ` [PATCH v4 5/8] mm: zswap: Store the folio's node id in the zswap_entry Kanchana P. Sridhar
2026-11-20 22:46 ` Nhat Pham
2026-11-20 23:01 ` Kanchana P. Sridhar
2026-11-21 4:20 ` sashiko-bot [this message]
2026-11-20 4:19 ` [PATCH v4 6/8] mm: zswap: Store large folios in batches Kanchana P. Sridhar
2026-11-20 23:08 ` Nhat Pham
2026-11-20 23:40 ` Kanchana P. Sridhar
2026-11-20 23:25 ` Nhat Pham
2026-11-20 23:51 ` Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 7/8] mm: zswap: Refactor and optimize zswap_store_pages() batch operations Kanchana P. Sridhar
2026-11-20 23:45 ` Nhat Pham
2026-11-21 1:36 ` Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 8/8] mm: zswap: Batched zswap_compress() for storing large folios in batches Kanchana P. Sridhar
2026-11-20 23:55 ` Nhat Pham
2026-11-21 1:17 ` Kanchana P. Sridhar
2026-11-21 3:24 ` Kanchana P. Sridhar
2026-11-21 4:20 ` sashiko-bot
2026-11-20 23:16 ` [PATCH v4 0/8] Batched zswap_store() framework with compression batching Nhat Pham
2026-11-21 1:04 ` Kanchana P. Sridhar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-226635@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=davem@davemloft.net \
--cc=hannes@cmpxchg.org \
--cc=herbert@gondor.apana.org.au \
--cc=kanchanapsridhar2026@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=rientjes@google.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=senozhatsky@chromium.org \
--cc=willy@infradead.org \
--cc=yosry@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.