mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: Vlastimil Babka <vbabka@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: kernel-team@meta.com, Hao Li <hao.li@linux.dev>,
	 Christoph Lameter <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mempool: fix min_nr exceeding the elements array after concurrent resizes
Date: Wed, 4 Nov 2026 12:16:46 +0000	[thread overview]
Message-ID: <aush3AHoVsuLJ_Ig@thinkstation> (raw)
In-Reply-To: <179330739525.606664.13318485044610934477.b4-ty@b4>

On Thu, Oct 29, 2026 at 08:59:01PM +0000, Harry Yoo (Meta) wrote:
> On Fri, 16 Oct 2026 09:25:10 -0400, Nickolai Zeldovich wrote:
> > mempool_resize() shrinks a pool by dropping pool->lock around every
> > free_fn() call and, once the pool holds no more than new_min_nr
> > elements, stores new_min_nr into pool->min_nr.  new_min_nr was only
> > compared against pool->min_nr before the lock was first dropped, so that
> > store assumes nothing changed meanwhile.  The kernel-doc allows
> > mempool_alloc()/mempool_free() to run while a resize is in progress and
> > the grow path also copes with concurrent resizes ("Raced, other resize
> > will do our work"), but the shrink path does not: while its lock is
> > dropped another resize may shrink the pool below new_min_nr and a third
> > one may grow it again to a size between the two, replacing
> > pool->elements with an array of exactly that size.  Storing the stale
> > new_min_nr afterwards leaves pool->min_nr larger than the elements
> > array.
> > 
> > [...]
> 
> Applied to mm/slab.git slab/for-next-fixes, thanks!
> 
> [1/1] mempool: fix min_nr exceeding the elements array after concurrent resizes
>       commit: 8dde7b06d2d819422c736dad7efb9635b6673cc2

For the record, I rerouted this from slab/for-next-fixes to
slab/for-next as it's not targeting -stable.

mempool: mempool: fix min_nr exceeding the elements array after concurrent resizes
commit: ce6518e61e3b4bf4f97f7ac6204049b9eba7eb75

-- 
Cheers,
Harry / Hyeonggon

      reply	other threads:[~2026-11-04 12:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 13:25 Nickolai Zeldovich
2026-10-16 15:46 ` Harry Yoo
2026-10-16 16:33   ` Nickolai Zeldovich
2026-10-18 15:01   ` Vitaly Wool
2026-10-18 15:15     ` Harry Yoo
2026-10-18 16:03       ` Vitaly Wool
2026-10-18 16:15         ` Harry Yoo
2026-10-19  6:45           ` Vitaly Wool
2026-10-19 13:27             ` Harry Yoo
2026-10-20  8:27             ` Vlastimil Babka (SUSE)
2026-10-20 10:50               ` Vitaly Wool
2026-10-20 10:57                 ` Harry Yoo
2026-10-20  8:42   ` Vlastimil Babka (SUSE)
2026-10-29 20:51     ` Harry Yoo
2026-10-28 15:44   ` Christoph Hellwig
2026-10-29 20:59 ` Harry Yoo (Meta)
2026-11-04 12:16   ` Harry Yoo [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=aush3AHoVsuLJ_Ig@thinkstation \
    --to=harry@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=hao.li@linux.dev \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nickolai@csail.mit.edu \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@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

all inboxes | Powered by JetHome®