From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: "Harry Yoo (Oracle)" <harry@kernel.org>
Cc: Levi Zim <i@kxxt.dev>,
linux-mm@kvack.org, rcu@vger.kernel.org, bpf@vger.kernel.org,
Hao Li <hao.li@linux.dev>,
"Paul E. McKenney" <paulmck@kernel.org>,
Uladzislau Rezki <urezki@gmail.com>,
Joel Fernandes <joelagnelf@nvidia.com>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Puranjay Mohan <puranjay@kernel.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Amery Hung <ameryhung@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>
Subject: Re: kmalloc_nolock() follow-ups, including kfree_rcu_nolock()
Date: Thu, 14 May 2026 16:26:40 +0200 [thread overview]
Message-ID: <d015da7b-fe08-40e8-b14d-2e012cce3684@kernel.org> (raw)
In-Reply-To: <3aza75jldxj4g3o4kqdif3hubsnzkv53jvj52y2crohfxzto74@ofzzq2wfc4tz>
On 5/14/26 12:09, Harry Yoo (Oracle) wrote:
> On Thu, May 14, 2026 at 11:39:50AM +0200, Vlastimil Babka (SUSE) wrote:
>> There's still the fallback to the larger bucket, right?
>> That pretty much guarantees that if we fail due to a local lock in one
>> bucket (due to preempting its holder), a local lock in another bucket won't
>> be locked at the same time.
>
> Right.
>
>> However if local sheaves are exhausted, we might need a shared lock (barn,
>> list_lock, slab bit lock when no double cmpxchg) and that might be held by
>> another cpu in both buckets. But should be very rare.
>
> I'm not sure what makes trylock failure on a list_lock rare?
That we can retry on different bucket. But maybe reality is different than
my hopes.
> When the local sheaves are exhausted, we're relying on either:
>
> 1) another kmalloc or buddy user on that CPU (w/ allow_spin = true)
> refills the local sheaves or PCP
>
> 2) trylock on list_lock or zone->lock succeeds
>
> Without async refills unlike the BPF memory allocator.
Maybe we'll need those for sheaves at some point? Hope not.
prev parent reply other threads:[~2026-05-14 14:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 12:25 kmalloc_nolock() follow-ups, including kfree_rcu_nolock() Harry Yoo (Oracle)
2026-05-12 13:46 ` Levi Zim
2026-05-13 1:42 ` Harry Yoo (Oracle)
2026-05-13 13:34 ` Levi Zim
2026-05-14 9:25 ` Harry Yoo (Oracle)
2026-05-14 9:39 ` Vlastimil Babka (SUSE)
2026-05-14 10:09 ` Harry Yoo (Oracle)
2026-05-14 14:26 ` Vlastimil Babka (SUSE) [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=d015da7b-fe08-40e8-b14d-2e012cce3684@kernel.org \
--to=vbabka@kernel.org \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=i@kxxt.dev \
--cc=joelagnelf@nvidia.com \
--cc=linux-mm@kvack.org \
--cc=memxor@gmail.com \
--cc=paulmck@kernel.org \
--cc=puranjay@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=shakeel.butt@linux.dev \
--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