Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hirotaka Yamagata" <hiro@pisnp.net>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Liam R. Howlett" <liam@infradead.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"David Hildenbrand" <david@kernel.org>,
	"Chris Li" <chrisl@kernel.org>,
	"Kairui Song" <kasong@tencent.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Hocko" <mhocko@kernel.org>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org,
	"John Stultz" <jstultz@google.com>,
	"Minchan Kim" <minchan@kernel.org>,
	"Alexandre Marciano Gimenez" <raging@google.com>,
	"Tatsuyuki Ishi" <ishitatsuyuki@google.com>,
	tj@kernel.org, mkoutny@suse.com
Subject: Re: [RFC PATCH v1 4/4] mm/volatile: add PGPURGE vmstat counter and purge tracepoint
Date: Tue, 01 Dec 2026 08:36:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-242856@kernel.org> (raw)
In-Reply-To: <20261130083407.2669584-5-hiro@pisnp.net>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm/volatile: __purge_volatile_folio() locks anon_vma for
  large folios
--

commit 989662cf3ea960d3c700d99d524e531e7df74975
Author: Hirotaka Yamagata <hiro@pisnp.net>

mm/volatile: add PGPURGE vmstat counter and purge tracepoint

This commit adds the PGPURGE vmstat and memcg event counter and the
mm_purge_volatile_folio tracepoint for volatile folio purging.

> diff --git a/mm/mvolatile.c b/mm/mvolatile.c
> index c111bc4f111d4..aa532d72d81cf 100644
> --- a/mm/mvolatile.c
> +++ b/mm/mvolatile.c
[ ... ]
> @@ -261,9 +264,13 @@ enum purge_result __purge_volatile_folio(struct folio *folio)
>  	if (!mapped)
>  		return PURGE_NONE;
>  
> -	/* Only order-0 folios are supported for now. */
> +	/*
> +	 * Only order-0 folios are supported for now. Checked after the
> +	 * volatile test so that the tracepoint shows large volatile folios
> +	 * falling back to swap.
> +	 */
>  	if (folio_test_large(folio))
> -		return PURGE_NONE;
> +		goto fail;

[Severity: Medium]
Does checking folio_test_large() after folio_lock_anon_vma_read() and the
anon_rmap_tree_foreach() walk cause unnecessary anon_vma lock contention on
every mapped large anonymous folio during page reclaim when the tracepoint
is disabled?

Once volatile_ranges_key is enabled, shrink_folio_list() calls
__purge_volatile_folio() on every folio it scans.  When
mm_purge_volatile_folio is disabled, the fail label just returns
PURGE_NONE, so checking folio_test_large(folio) &&
!trace_mm_purge_volatile_folio_enabled() before folio_lock_anon_vma_read()
would avoid locking anon_vma and walking the rmap tree for large folios.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130083407.2669584-1-hiro@pisnp.net?part=4

  reply	other threads:[~2026-12-01  8:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  8:34 [RFC PATCH v1 0/4] mm: port MADV_VOLATILE and MADV_NONVOLATILE to v7.3-rc1 Hirotaka Yamagata
2026-11-30  8:34 ` [RFC PATCH v1 1/4] mm: introduce VM_VOLATILE and MADV_VOLATILE/MADV_NONVOLATILE VMA handling Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot
2026-11-30  8:34 ` [RFC PATCH v1 2/4] mm: add PTE_MARKER_PURGED and TTU_PURGE for purged volatile pages Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot
2026-11-30  8:34 ` [RFC PATCH v1 3/4] mm/volatile: purge volatile anonymous folios during reclaim Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot
2026-11-30  8:34 ` [RFC PATCH v1 4/4] mm/volatile: add PGPURGE vmstat counter and purge tracepoint Hirotaka Yamagata
2026-12-01  8:36   ` sashiko-bot [this message]
2026-11-30 10:39 ` [RFC PATCH v1 0/4] mm: port MADV_VOLATILE and MADV_NONVOLATILE to v7.3-rc1 David Hildenbrand (Arm)
2026-11-30 18:18   ` Lorenzo Stoakes (ARM)

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-242856@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hiro@pisnp.net \
    --cc=ishitatsuyuki@google.com \
    --cc=jstultz@google.com \
    --cc=kasong@tencent.com \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=minchan@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=raging@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox