lkml.org 
[lkml]   [2021]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC 3/3] mm/slub: add all_objects implementation in debugfs
From
Date
On 5/21/21 2:11 PM, glittao@gmail.com wrote:
> From: Oliver Glitta <glittao@gmail.com>
>
> Add all_objects implementation to debugfs to print information
> about all objects in slub cache.

An example listing of 1-2 objects would be useful in the changelog.

Also can you describe what are the guarantees (or limitations) of observing
really all objects if the cache is modified by concurrent allocation and free
operations?

...

> +static void *debugfs_all_objects_start(struct seq_file *m, loff_t *ppos)
> +{
> + struct slab_debug_private *priv = m->private;
> + struct kmem_cache *s = priv->inode->i_private;
> + struct page *page;
> +
> + priv->map = kmalloc(BITS_TO_LONGS(MAX_OBJS_PER_PAGE), GFP_KERNEL);

We can use bitmap_alloc/bitmap_free wrappers and allocate according to objects
per page in the actual kmem_cache, not the theoretical maximum, see:
https://lore.kernel.org/linux-mm/20210524233946.20352-2-vbabka@suse.cz/

\
 
 \ /
  Last update: 2021-05-26 16:27    [W:0.131 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site