From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Harry Yoo <harry@kernel.org>
Cc: Vlastimil Babka <vbabka@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
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, loongarch@lists.linux.dev,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm/slub: Genericize x86-specific cmpxchg16b comment
Date: Tue, 3 Nov 2026 09:52:11 +0800 [thread overview]
Message-ID: <5ce58389-db68-54f2-51fb-0d43b0e0cb2d@loongson.cn> (raw)
In-Reply-To: <auihvtpGJPDbb4Hz@thinkstation>
On 2026/11/2 下午10:49, Harry Yoo wrote:
> On Mon, Nov 02, 2026 at 04:27:30PM +0800, Tiezhu Yang wrote:
>> The kmalloc_nolock() infrastructure relies on slab caches with double-word
>> atomic cmpxchg capabilities (__CMPXCHG_DOUBLE). The current inline comment
>> in __kmalloc_nolock_noprof() uses 'cmpxchg16b' as the prerequisite hardware
>> capability.
...
>> diff --git a/mm/slub.c b/mm/slub.c
>> index 45e077c7526c..216bc6b5d776 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -5589,8 +5589,8 @@ static void *__kmalloc_nolock_noprof(DECL_TOKEN_PARAMS(size, token), gfp_t gfp_f
>> if (!(s->flags & __CMPXCHG_DOUBLE) && !kmem_cache_debug(s))
>> /*
>> * kmalloc_nolock() is not supported on architectures that
>> - * don't implement cmpxchg16b and thus need slab_lock()
>> - * which could be preempted by a nmi.
>> + * don't implement 128-bit atomic cmpxchg and thus need
>> + * slab_lock() which could be preempted by a nmi.
>
> maybe "double-width atomic cmpxchg" is more accurate considering
> e.g.) x86-32 implements cmpxchg8b?
OK. Using "double-width atomic cmpxchg" is much more accurate
as it perfectly covers both 32-bit and 64-bit platforms, and
aligns well with the __CMPXCHG_DOUBLE flag.
I will send out v2 with this update later if no more comments.
Thanks,
Tiezhu
prev parent reply other threads:[~2026-11-03 1:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 8:27 Tiezhu Yang
2026-11-02 14:49 ` Harry Yoo
2026-11-03 1:52 ` Tiezhu Yang [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=5ce58389-db68-54f2-51fb-0d43b0e0cb2d@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=akpm@linux-foundation.org \
--cc=bpf@vger.kernel.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=loongarch@lists.linux.dev \
--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®