All of lore.kernel.org
 help / color / mirror / Atom feed
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 v5 6/9] mm: zswap: Obtain folio's wb_enabled status once in zswap_store().
Date: Wed, 02 Dec 2026 05:38:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-244914@kernel.org> (raw)
In-Reply-To: <20261201053711.8090-7-kanchanapsridhar2026@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm: zswap: unconditional memcg walk in zswap_store() on
  compressible folios
--

commit b0a698a16636e6d780852601de469cf0d0c4e0bf
Author: Kanchana P. Sridhar <kanchanapsridhar2026@gmail.com>

mm: zswap: Obtain folio's wb_enabled status once in zswap_store().

This commit queries mem_cgroup_zswap_writeback_enabled() once in
zswap_store() and passes the result down through zswap_store_page() to
zswap_compress().

> diff --git a/mm/zswap.c b/mm/zswap.c
> index cdca497ef8dbb..c0c00696599b1 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c

[ ... ]

> @@ -942,12 +943,8 @@ static bool zswap_compress(struct folio *folio, long index,
>  	 * to the active LRU list in the case.
>  	 */
>  	if (comp_ret) {
> -		rcu_read_lock();
> -		if (!mem_cgroup_zswap_writeback_enabled(folio_memcg(folio))) {
> -			rcu_read_unlock();
> +		if (!wb_enabled)
>  			goto unlock;
> -		}
> -		rcu_read_unlock();
>  		comp_ret = 0;
>  		dlen = PAGE_SIZE;
>  		dst = kmap_local_folio(folio, index * PAGE_SIZE);

[ ... ]

> @@ -1658,8 +1657,12 @@ bool zswap_store(struct folio *folio)
>  		mem_cgroup_put(memcg);
>  	}
>  
> +	rcu_read_lock();
> +	wb_enabled = mem_cgroup_zswap_writeback_enabled(folio_memcg(folio));
> +	rcu_read_unlock();
> +
>  	for (index = 0; index < nr_pages; ++index) {
> -		if (!zswap_store_page(folio, index, objcg, pool))
> +		if (!zswap_store_page(folio, index, objcg, pool, wb_enabled))
>  			goto put_pool;
>  	}

[Severity: Medium]
Does hoisting mem_cgroup_zswap_writeback_enabled() into zswap_store()
add an unconditional cgroup hierarchy walk on the hot swap-out path for
compressible folios?

In zswap_compress(), wb_enabled is only checked inside the if (comp_ret)
fallback when a page fails to compress below PAGE_SIZE.  On the common
fast path where all pages in the folio compress normally (comp_ret == 0),
mem_cgroup_zswap_writeback_enabled() was previously not called at all,
whereas zswap_store() now walks parent_mem_cgroup(memcg) up to the root
memcg on every folio store even when wb_enabled is never used.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201053711.8090-1-kanchanapsridhar2026@gmail.com?part=6

  reply	other threads:[~2026-12-02  5:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  5:37 [PATCH v5 0/9] Batched zswap_store() framework with compression batching Kanchana P. Sridhar
2026-12-01  5:37 ` [PATCH v5 1/9] 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-12-01  5:37 ` [PATCH v5 2/9] crypto: acomp - Add bit to indicate segmentation support Kanchana P. Sridhar
2026-12-01  5:37 ` [PATCH v5 3/9] crypto: acomp - Add trivial segmentation wrapper Kanchana P. Sridhar
2026-12-01  5:37 ` [PATCH v5 4/9] crypto: acomp - Add API to get a compression algorithm's batch-size Kanchana P. Sridhar
2026-12-01  5:37 ` [PATCH v5 5/9] mm: zswap: Store the folio's node id in the zswap_entry Kanchana P. Sridhar
2026-12-02  5:38   ` sashiko-bot
2026-12-01  5:37 ` [PATCH v5 6/9] mm: zswap: Obtain folio's wb_enabled status once in zswap_store() Kanchana P. Sridhar
2026-12-02  5:38   ` sashiko-bot [this message]
2026-12-01  5:37 ` [PATCH v5 7/9] mm: zswap: Store large folios in batches Kanchana P. Sridhar
2026-12-02  5:38   ` sashiko-bot
2026-12-01  5:37 ` [PATCH v5 8/9] mm: zswap: Refactor and optimize zswap_store_pages() batch operations Kanchana P. Sridhar
2026-12-01  5:37 ` [PATCH v5 9/9] mm: zswap: Batched zswap_compress() for storing large folios in batches Kanchana P. Sridhar
2026-12-02  5:38   ` sashiko-bot

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-244914@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.