Re: [PATCH v5] mm: slub: move sysfs slab alloc/free interfaces to debugfs

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

 



On Tue, May 18, 2021 at 06:24:48PM +0530, Faiyaz Mohammed wrote:
> 
> 
> On 5/7/2021 5:18 PM, Greg KH wrote:
> > On Thu, May 06, 2021 at 03:52:03PM +0530, Faiyaz Mohammed wrote:
> >> alloc_calls and free_calls implementation in sysfs have two issues,
> >> one is PAGE_SIZE limitiation of sysfs and other is it does not adhere
> >> to "one value per file" rule.
> >>
> >> To overcome this issues, move the alloc_calls and free_calls implemeation
> >> to debugfs.
> >>
> >> Rename the alloc_calls/free_calls to alloc_traces/free_traces,
> >> to be inline with what it does.
> >>
> >> Signed-off-by: Faiyaz Mohammed <faiyazm@xxxxxxxxxxxxxx>
> >> ---
> >>  include/linux/slub_def.h |  10 ++
> >>  mm/slab_common.c         |   9 ++
> >>  mm/slub.c                | 362 ++++++++++++++++++++++++++++++++++++-----------
> >>  3 files changed, 299 insertions(+), 82 deletions(-)
> >>
> >> diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
> >> index dcde82a..f8c268d 100644
> >> --- a/include/linux/slub_def.h
> >> +++ b/include/linux/slub_def.h
> >> @@ -110,6 +110,9 @@ struct kmem_cache {
> >>  #ifdef CONFIG_SYSFS
> >>  	struct kobject kobj;	/* For sysfs */
> >>  #endif
> >> +#ifdef CONFIG_SLUB_DEBUG
> >> +	struct dentry *slab_cache_dentry;
> >> +#endif
> >>  #ifdef CONFIG_SLAB_FREELIST_HARDENED
> >>  	unsigned long random;
> >>  #endif
> >> @@ -159,6 +162,13 @@ static inline void sysfs_slab_release(struct kmem_cache *s)
> >>  }
> >>  #endif
> >>  
> >> +#ifdef CONFIG_DEBUG_FS
> >> +void debugfs_slab_release(struct kmem_cache *);
> >> +#else
> >> +static inline void debugfs_slab_release(struct kmem_cache *s)
> >> +{
> >> +}
> >> +#endif
> >>  void object_err(struct kmem_cache *s, struct page *page,
> >>  		u8 *object, char *reason);
> >>  
> >> diff --git a/mm/slab_common.c b/mm/slab_common.c
> >> index f8833d3..f3afe6b 100644
> >> --- a/mm/slab_common.c
> >> +++ b/mm/slab_common.c
> >> @@ -445,6 +445,9 @@ static void slab_caches_to_rcu_destroy_workfn(struct work_struct *work)
> >>  #else
> >>  		slab_kmem_cache_release(s);
> >>  #endif
> >> +#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_SLUB)
> >> +		debugfs_slab_release(s);
> >> +#endif
> > 
> > If you write your .h files correctly, no need for #ifdef in a .c file.
> > 
> > Please fix up.
> > 
> fixed in new patch and used the single #ifded because
> debugfs_slab_release declaration is there in slub_def.h and slab_common
> is used for both slab and slub.
> Like SLAB_SUPPORTS_SYSFS, SLAB_SUPPORT_DEBUGFS will be not defined if
> slab config is used.

No, you should have have any #ifdef at all, as I point out in that
review.

thanks,

greg k-h




[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