Messages in this thread | | | Subject | Re: [PATCH v6] mm: slub: move sysfs slab alloc/free interfaces to debugfs | From | Faiyaz Mohammed <> | Date | Fri, 21 May 2021 17:09:32 +0530 |
| |
On 5/21/2021 4:43 PM, Vlastimil Babka wrote: > On 5/18/21 2:45 PM, 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. >> >> Reported-by: kernel test robot <lkp@intel.com> >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> >> Signed-off-by: Faiyaz Mohammed <faiyazm@codeaurora.org> > > >> @@ -5817,6 +5769,249 @@ static int __init slab_sysfs_init(void) >> __initcall(slab_sysfs_init); >> #endif /* CONFIG_SYSFS */ >> >> +#if defined(CONFIG_SLUB_DEBUG) && defined(CONFIG_DEBUG_FS) >> +static int debugfs_slab_alias(struct kmem_cache *s, const char *name) >> +{ >> + struct saved_alias *al; >> + struct dentry *slab_cache_dir; >> + >> + if (slab_state == FULL) { >> + /* >> + * If we have a leftover link then remove it. >> + */ >> + slab_cache_dir = debugfs_lookup(s->name, slab_debugfs_root); >> + debugfs_remove(slab_cache_dir); >> + debugfs_create_symlink(name, slab_debugfs_root, NULL); > > v6 got stuck on boot for me, unlike v5, seems like here you should return 0? > That helped > oh, it worked me without return, but I think yes, have to return from here once the symlink is created like sysfs_slab_alias do. I will update in next patch version.
>> + } >> + >> + al = kmalloc(sizeof(struct saved_alias), GFP_KERNEL); >> + if (!al) >> + return -ENOMEM; >> + >> + al->s = s; >> + al->name = name; >> + al->next = alias_list; >> + alias_list = al; >> + return 0; >> +} >> +
Thanks and regards, Mohammed Faiyaz
| |