Re: [PATCH v1] mm/slub: Genericize x86-specific cmpxchg16b comment
From: Tiezhu Yang
Date: Mon Nov 02 2026 - 20:52:38 EST
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