Re: [RFC][PATCH 2/4] mm, slub: implement slub allocate post callback for page_owner

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



November 9, 2023 at 10:05 PM, "Matthew Wilcox" <willy@xxxxxxxxxxxxx> 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@xxxxxxxxx) just now. 
Thank you for your advice. Indeed, the "data" didn't serve any purpose here.

--
Jeff Xie





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux