From: Hao Li <hao.li@linux.dev>
To: Harry Yoo <harry.yoo@oracle.com>
Cc: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
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] slab: distinguish lock and trylock for sheaf_flush_main()
Date: Wed, 4 Mar 2026 11:01:46 +0800 [thread overview]
Message-ID: <yek6rgfynwx4c6oel7wmdfun6zrr6tpvu6w7cywjvdl4d4gwjt@rdkwypxx2iwp> (raw)
In-Reply-To: <aaeFV4TWm2jGzVl6@hyeyoo>
On Wed, Mar 04, 2026 at 10:05:27AM +0900, Harry Yoo wrote:
> On Mon, Mar 02, 2026 at 10:56:44AM +0100, Vlastimil Babka (SUSE) wrote:
> > On 2/26/26 15:50, Vlastimil Babka (SUSE) wrote:
> > > On 2/11/26 10:42, Vlastimil Babka wrote:
> > >> sheaf_flush_main() can be called from __pcs_replace_full_main() where
> > >> the trylock can in theory fail, and pcs_flush_all() where it's not
> > >> expected to and it would be actually a problem if it failed and left the
> > >> main sheaf not flushed.
> > >
> > > Thinking about this more, I now think it's not a theoretical issue because
> > > on PREEMPT_RT I think pcs_flush_all() can preempt someone holding the lock
>
> Agreed!
Exactly, not just theoretical.
>
> > > (on PREEMPT_RT it doesn't have to be an irq handler preempting a holder),
> > > and then fail to flush the main sheaf silently.
> > >
> > > The impact is probably limited though - if this failure to flush happens in
> > > __kmem_cache_shutdown(), it means someone was destroying a cache while using
> > > it, so that was already buggy.
Exactly.
> > > slab_mem_going_offline_callback() could be
> > > where this matters although it's unlikely someone would do memory hotplug
> > > together with PREEMPT_RT.
Yes, given the semantics of slab_mem_going_offline_callback(),
sheaf_flush_main() really should ensure that all objects are flushed out.
--
Thanks,
Hao
> > >
> > > But maybe still worth tagging this as Fixes: 2d517aa09bbc ("slab: add opt-in
> > > caching layer of percpu sheaves") and Cc stable and sending it as a hotfix.
> >
> > Added to slab/for-next-fixes with adjusted changelog:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git/commit/?h=slab*for-next-fixes&id=48647d3f9a644d1e81af6558102d43cdb260597b
>
> --
> Cheers,
> Harry / Hyeonggon
prev parent reply other threads:[~2026-03-04 3:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 9:42 Vlastimil Babka
2026-02-12 3:11 ` Harry Yoo
2026-02-12 6:48 ` Hao Li
2026-02-26 14:50 ` Vlastimil Babka (SUSE)
2026-03-02 9:56 ` Vlastimil Babka (SUSE)
2026-03-04 1:05 ` Harry Yoo
2026-03-04 3:01 ` Hao Li [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=yek6rgfynwx4c6oel7wmdfun6zrr6tpvu6w7cywjvdl4d4gwjt@rdkwypxx2iwp \
--to=hao.li@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=harry.yoo@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mtosatti@redhat.com \
--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