]> Git Repo - linux.git/commitdiff
mm: slab: fix comment for __assume_kmalloc_alignment
authorAndrey Konovalov <[email protected]>
Thu, 28 Apr 2022 15:59:40 +0000 (17:59 +0200)
committerVlastimil Babka <[email protected]>
Mon, 2 May 2022 08:47:25 +0000 (10:47 +0200)
The comment next to the __assume_kmalloc_alignment definition is not
precise: kmalloc relies on kmem_cache_alloc, so kmalloc technically returns
pointers aligned to both ARCH_KMALLOC_MINALIGN and ARCH_SLAB_MINALIGN,
not only to ARCH_KMALLOC_MINALIGN.

(See create_kmalloc_cache()->create_boot_cache()->calculate_alignment()
 for SLAB and SLUB and __do_kmalloc_node() for SLOB.)

Clarify the comment.

The assumption specified by __assume_kmalloc_alignment is still correct,
although it can be made stronger. I'll leave this to a separate patch.

Signed-off-by: Andrey Konovalov <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>
Link: https://lore.kernel.org/r/84d8142747230f2015eaf9705ee7c2e1a9f56596.1651161548.git.andreyknvl@google.com
include/linux/slab.h

index 8c090599fc210db78085c149f5e912b103d7fe2e..58bb9392775d5b91b1afb224a9c7bd8dc572eccb 100644 (file)
@@ -217,9 +217,9 @@ void kmem_dump_obj(void *object);
 #endif
 
 /*
- * kmalloc and friends return ARCH_KMALLOC_MINALIGN aligned
- * pointers. kmem_cache_alloc and friends return ARCH_SLAB_MINALIGN
- * aligned pointers.
+ * kmem_cache_alloc and friends return pointers aligned to ARCH_SLAB_MINALIGN.
+ * kmalloc and friends return pointers aligned to both ARCH_KMALLOC_MINALIGN
+ * and ARCH_SLAB_MINALIGN, but here we only assume the former alignment.
  */
 #define __assume_kmalloc_alignment __assume_aligned(ARCH_KMALLOC_MINALIGN)
 #define __assume_slab_alignment __assume_aligned(ARCH_SLAB_MINALIGN)
This page took 0.05622 seconds and 4 git commands to generate.