Re: [RESEND PATCH] mm: slab: Do not create kmalloc caches smaller than arch_slab_minalign()

From: Vlastimil Babka
Date: Wed Oct 11 2023 - 09:31:56 EST


On 10/9/23 13:20, Catalin Marinas wrote:
>> > mm/slab_common.c | 7 +++++--
>> > 1 file changed, 5 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/mm/slab_common.c b/mm/slab_common.c
>> > index cd71f9581e67..8b45922ed295 100644
>> > --- a/mm/slab_common.c
>> > +++ b/mm/slab_common.c
>> > @@ -895,10 +895,13 @@ void __init setup_kmalloc_cache_index_table(void)
>> >
>> > static unsigned int __kmalloc_minalign(void)
>> > {
>> > + unsigned int minalign = dma_get_cache_alignment();
>> > +
>> > if (IS_ENABLED(CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC) &&
>> > is_swiotlb_allocated())
>> > - return ARCH_KMALLOC_MINALIGN;
>> > - return dma_get_cache_alignment();
>> > + minalign = ARCH_KMALLOC_MINALIGN;
>> > +
>> > + return ALIGN(minalign, arch_slab_minalign());
>>
>> Could it be max() instead of ALIGN()? It would be more obvious, at least to
>> me :)
>
> Yeah, max() would do since they are all a power of two. Do you want me
> to repost?

No need, picked up and changed locally. Thanks!