[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d35ce303-c72d-2c7f-8785-4aee7237d05e@suse.cz>
Date: Thu, 24 Mar 2022 18:46:34 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Hyeonggon Yoo <42.hyeyoo@...il.com>, linux-mm@...ck.org
Cc: Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Marco Elver <elver@...gle.com>,
Matthew WilCox <willy@...radead.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v1 08/15] mm/sl[auo]b: cleanup kmalloc()
On 3/8/22 12:41, Hyeonggon Yoo wrote:
> Now that kmalloc() and kmalloc_node() do same job, make kmalloc()
> wrapper of kmalloc_node().
>
> Remove kmalloc_trace() that is now unused. This patch makes slab
> allocator use kmalloc_node tracepoints in kmalloc().
>
> Signed-off-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
Actually there are more things to fix than the commit log.
> +#ifndef CONFIG_SLOB
> +static __always_inline __alloc_size(1) void *kmalloc_node(size_t size, gfp_t flags, int node)
> +{
> + if (__builtin_constant_p(size)) {
> + unsigned int index;
> +
> + if (size > KMALLOC_MAX_CACHE_SIZE)
> + return kmalloc_large(size, flags);
Should use kmalloc_large_node().
> +
> + index = kmalloc_index(size);
> +
> + if (!index)
> + return ZERO_SIZE_PTR;
> +
> + return kmem_cache_alloc_node_trace(
> + kmalloc_caches[kmalloc_type(flags)][index],
> + flags, node, size);
> + }
> + return __kmalloc_node(size, flags, node);
> +}
> +#else
> +static __always_inline __alloc_size(1) void *kmalloc_node(size_t size, gfp_t flags, int node)
> +{
> + if (__builtin_constant_p(size) && size > KMALLOC_MAX_CACHE_SIZE)
> + return kmalloc_large(size, flags);
And here.
> +
> + return __kmalloc_node(size, flags, node);
> +}
> +#endif
Powered by blists - more mailing lists