[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58b99c29425dd61130f04b41be14e3609daf5a91@linux.dev>
Date: Thu, 09 Nov 2023 15:34:25 +0000
From: jeff.xie@...ux.dev
To: "Matthew Wilcox" <willy@...radead.org>
Cc: akpm@...ux-foundation.org, iamjoonsoo.kim@....com, vbabka@...e.cz,
cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
roman.gushchin@...ux.dev, 42.hyeyoo@...il.com, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
chensong_2000@....cn, xiehuan09@...il.com
Subject: Re: [RFC][PATCH 2/4] mm, slub: implement slub allocate post callback
for page_owner
November 9, 2023 at 10:05 PM, "Matthew Wilcox" <willy@...radead.org> wrote:
>
> On Thu, Nov 09, 2023 at 11:25:19AM +0800, Jeff Xie wrote:
>
> >
> > +#ifdef CONFIG_PAGE_OWNER
> > +static int slab_alloc_post_page_owner(struct folio *folio, struct task_struct *tsk,
> > + void *data, char *kbuf, size_t count)
> > +{
> > + int ret;
> > + struct kmem_cache *kmem_cache = data;
> > +
> > + ret = scnprintf(kbuf, count, "SLAB_PAGE slab_name:%s\n", kmem_cache->name);
> > +
> > + return ret;
> > +}
> > +#endif
> >
>
> Or we could do this typesafely ...
>
> struct slab *slab = folio_slab(folio);
> struct kmem_cache *kmem_cache = slab->slab_cache;
>
> ... and then there's no need to pass in a 'data' to the function.
>
I accidentally replied using my other email (xiehuan09@...il.com) just now.
Thank you for your advice. Indeed, the "data" didn't serve any purpose here.
--
Jeff Xie
Powered by blists - more mailing lists