linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <baoquan.he@linux.dev>
To: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Baoquan He <bhe@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	stable@vger.kernel.org, chenyichong <chenyichong@uniontech.com>
Subject: Re: [PATCH] mm/vmalloc: Take vmap_purge_lock in shrinker
Date: Tue, 14 Apr 2026 15:20:33 +0800	[thread overview]
Message-ID: <ad3qwblVAJ0tUQBF@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20260413192646.14683-1-urezki@gmail.com>

On 04/13/26 at 09:26pm, Uladzislau Rezki (Sony) wrote:
> decay_va_pool_node() can be invoked concurrently from two paths:
> __purge_vmap_area_lazy() when pools are being purged, and the
> shrinker via vmap_node_shrink_scan().
> 
> However, decay_va_pool_node() is not safe to run concurrently,
> and the shrinker path currently lacks serialization, leading
> to races and possible leaks.
> 
> Protect decay_va_pool_node() by taking vmap_purge_lock in the
> shrinker path to ensure serialization with purge users.
> 
> Cc: stable@vger.kernel.org
> Cc: chenyichong <chenyichong@uniontech.com>
> Fixes: 7679ba6b36db ("mm: vmalloc: add a shrinker to drain vmap pools")
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> ---
>  mm/vmalloc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 61caa55a4402..676851d5cfe7 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -5416,6 +5416,7 @@ vmap_node_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
>  {
>  	struct vmap_node *vn;
>  
> +	guard(mutex)(&vmap_purge_lock);
>  	for_each_vmap_node(vn)
>  		decay_va_pool_node(vn, true);

LGTM,

Reviewed-by: Baoquan He <baoquan.he@linux.dev>



      reply	other threads:[~2026-04-14  7:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 19:26 Uladzislau Rezki (Sony)
2026-04-14  7:20 ` Baoquan He [this message]

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=ad3qwblVAJ0tUQBF@MiWiFi-R3L-srv \
    --to=baoquan.he@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=chenyichong@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --cc=urezki@gmail.com \
    /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