lkml.org 
[lkml]   [2022]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v1 08/15] mm/sl[auo]b: cleanup kmalloc()
On Thu, Mar 24, 2022 at 06:46:34PM +0100, Vlastimil Babka wrote:
> 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@gmail.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.
>

Sorry for the mistake. did it in v2. thanks!

> > +
> > + return __kmalloc_node(size, flags, node);
> > +}
> > +#endif

--
Thanks,
Hyeonggon

\
 
 \ /
  Last update: 2022-04-22 14:46    [W:0.054 / U:1.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site