* [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN
@ 2022-04-28 15:59 andrey.konovalov
2022-04-28 15:59 ` [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment andrey.konovalov
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: andrey.konovalov @ 2022-04-28 15:59 UTC (permalink / raw)
To: Andrew Morton
Cc: Andrey Konovalov, Christoph Lameter, Pekka Enberg,
David Rientjes, Joonsoo Kim, Vlastimil Babka, Roman Gushchin,
Peter Collingbourne, linux-mm, linux-kernel, Andrey Konovalov
From: Andrey Konovalov <andreyknvl@google.com>
The comment next to the ARCH_KMALLOC_MINALIGN definition says that
ARCH_KMALLOC_MINALIGN can be defined in arch headers. This is incorrect:
it's actually ARCH_DMA_MINALIGN that can be defined there.
Fix the comment.
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---
include/linux/slab.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 373b3ef99f4e..8cc1d54e56ad 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -190,7 +190,7 @@ void kmem_dump_obj(void *object);
/*
* Some archs want to perform DMA into kmalloc caches and need a guaranteed
* alignment larger than the alignment of a 64-bit integer.
- * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
+ * Setting ARCH_DMA_MINALIGN in arch headers allows that.
*/
#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment
2022-04-28 15:59 [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN andrey.konovalov
@ 2022-04-28 15:59 ` andrey.konovalov
2022-05-02 0:13 ` David Rientjes
2022-04-29 7:32 ` [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN Christoph Lameter
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: andrey.konovalov @ 2022-04-28 15:59 UTC (permalink / raw)
To: Andrew Morton
Cc: Andrey Konovalov, Christoph Lameter, Pekka Enberg,
David Rientjes, Joonsoo Kim, Vlastimil Babka, Roman Gushchin,
Peter Collingbourne, linux-mm, linux-kernel, Andrey Konovalov
From: Andrey Konovalov <andreyknvl@google.com>
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 <andreyknvl@google.com>
---
include/linux/slab.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 8cc1d54e56ad..06323a4beff0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -210,9 +210,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)
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN
2022-04-28 15:59 [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN andrey.konovalov
2022-04-28 15:59 ` [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment andrey.konovalov
@ 2022-04-29 7:32 ` Christoph Lameter
2022-04-29 9:41 ` Vlastimil Babka
2022-05-02 0:13 ` David Rientjes
3 siblings, 0 replies; 6+ messages in thread
From: Christoph Lameter @ 2022-04-29 7:32 UTC (permalink / raw)
To: andrey.konovalov
Cc: Andrew Morton, Andrey Konovalov, Pekka Enberg, David Rientjes,
Joonsoo Kim, Vlastimil Babka, Roman Gushchin,
Peter Collingbourne, linux-mm, linux-kernel, Andrey Konovalov
On Thu, 28 Apr 2022, andrey.konovalov@linux.dev wrote:
> From: Andrey Konovalov <andreyknvl@google.com>
>
> The comment next to the ARCH_KMALLOC_MINALIGN definition says that
> ARCH_KMALLOC_MINALIGN can be defined in arch headers. This is incorrect:
> it's actually ARCH_DMA_MINALIGN that can be defined there.
The section is talking about kmalloc and not general kmem_cache_alloc()
and there was the intention of separating the alignment requirements
between these two groups of caches in the slab allocators.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN
2022-04-28 15:59 [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN andrey.konovalov
2022-04-28 15:59 ` [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment andrey.konovalov
2022-04-29 7:32 ` [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN Christoph Lameter
@ 2022-04-29 9:41 ` Vlastimil Babka
2022-05-02 0:13 ` David Rientjes
3 siblings, 0 replies; 6+ messages in thread
From: Vlastimil Babka @ 2022-04-29 9:41 UTC (permalink / raw)
To: andrey.konovalov, Andrew Morton
Cc: Andrey Konovalov, Christoph Lameter, Pekka Enberg,
David Rientjes, Joonsoo Kim, Roman Gushchin, Peter Collingbourne,
linux-mm, linux-kernel, Andrey Konovalov
On 4/28/22 17:59, andrey.konovalov@linux.dev wrote:
> From: Andrey Konovalov <andreyknvl@google.com>
>
> The comment next to the ARCH_KMALLOC_MINALIGN definition says that
> ARCH_KMALLOC_MINALIGN can be defined in arch headers. This is incorrect:
> it's actually ARCH_DMA_MINALIGN that can be defined there.
>
> Fix the comment.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Thanks, added both patches to the slab tree.
> ---
> include/linux/slab.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 373b3ef99f4e..8cc1d54e56ad 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -190,7 +190,7 @@ void kmem_dump_obj(void *object);
> /*
> * Some archs want to perform DMA into kmalloc caches and need a guaranteed
> * alignment larger than the alignment of a 64-bit integer.
> - * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
> + * Setting ARCH_DMA_MINALIGN in arch headers allows that.
> */
> #if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
> #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN
2022-04-28 15:59 [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN andrey.konovalov
` (2 preceding siblings ...)
2022-04-29 9:41 ` Vlastimil Babka
@ 2022-05-02 0:13 ` David Rientjes
3 siblings, 0 replies; 6+ messages in thread
From: David Rientjes @ 2022-05-02 0:13 UTC (permalink / raw)
To: andrey.konovalov
Cc: Andrew Morton, Andrey Konovalov, Christoph Lameter, Pekka Enberg,
Joonsoo Kim, Vlastimil Babka, Roman Gushchin,
Peter Collingbourne, linux-mm, linux-kernel, Andrey Konovalov
On Thu, 28 Apr 2022, andrey.konovalov@linux.dev wrote:
> From: Andrey Konovalov <andreyknvl@google.com>
>
> The comment next to the ARCH_KMALLOC_MINALIGN definition says that
> ARCH_KMALLOC_MINALIGN can be defined in arch headers. This is incorrect:
> it's actually ARCH_DMA_MINALIGN that can be defined there.
>
> Fix the comment.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: David Rientjes <rientjes@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment
2022-04-28 15:59 ` [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment andrey.konovalov
@ 2022-05-02 0:13 ` David Rientjes
0 siblings, 0 replies; 6+ messages in thread
From: David Rientjes @ 2022-05-02 0:13 UTC (permalink / raw)
To: andrey.konovalov
Cc: Andrew Morton, Andrey Konovalov, Christoph Lameter, Pekka Enberg,
Joonsoo Kim, Vlastimil Babka, Roman Gushchin,
Peter Collingbourne, linux-mm, linux-kernel, Andrey Konovalov
On Thu, 28 Apr 2022, andrey.konovalov@linux.dev wrote:
> From: Andrey Konovalov <andreyknvl@google.com>
>
> 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 <andreyknvl@google.com>
Acked-by: David Rientjes <rientjes@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-02 0:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 15:59 [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN andrey.konovalov
2022-04-28 15:59 ` [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment andrey.konovalov
2022-05-02 0:13 ` David Rientjes
2022-04-29 7:32 ` [PATCH 1/2] mm: slab: fix comment for ARCH_KMALLOC_MINALIGN Christoph Lameter
2022-04-29 9:41 ` Vlastimil Babka
2022-05-02 0:13 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).