lkml.org 
[lkml]   [2022]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 02/16] mm: introduce kmem_cache_alloc_lru
On Sun, Jan 09, 2022 at 02:21:22PM +0800, Muchun Song wrote:
> On Fri, Jan 7, 2022 at 11:05 AM Roman Gushchin <guro@fb.com> wrote:
> >
> [...]
> > > /*
> > > * struct kmem_cache related prototypes
> > > @@ -425,6 +426,8 @@ static __always_inline unsigned int __kmalloc_index(size_t size,
> > >
> > > void *__kmalloc(size_t size, gfp_t flags) __assume_kmalloc_alignment __alloc_size(1);
> > > void *kmem_cache_alloc(struct kmem_cache *s, gfp_t flags) __assume_slab_alignment __malloc;
> > > +void *kmem_cache_alloc_lru(struct kmem_cache *s, struct list_lru *lru,
> > > + gfp_t gfpflags) __assume_slab_alignment __malloc;
> >
> > I'm not a big fan of this patch: I don't see why preparing the lru
> > infrastructure has to be integrated that deep into the slab code.
> >
> > Why can't kmem_cache_alloc_lru() be a simple wrapper like (pseudo-code):
> > void *kmem_cache_alloc_lru(struct kmem_cache *s, struct list_lru *lru,
> > gfp_t gfpflags) {
> > if (necessarily)
> > prepare_lru_infra();
> > return kmem_cache_alloc();
> > }
>
> Hi Roman,
>
> Actually, it can. But there is going to be some redundant code similar
> like memcg_slab_pre_alloc_hook() does to detect the necessity of
> prepare_lru_infra() in the new scheme of kmem_cache_alloc_lru().
> I just want to reduce the redundant overhead.

Is this about getting a memcg pointer?
I doubt it's a good reason to make changes all over the slab code.
Another option to consider adding a new gfp flag.

Vlastimil, what do you think?

Thanks!

\
 
 \ /
  Last update: 2022-01-10 19:48    [W:0.076 / U:1.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site