Thread (7 messages) 7 messages, 3 authors, 2021-05-21

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

From: Vlastimil Babka <hidden>
Date: 2021-05-21 11:13:57
Also in: lkml

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 <redacted>
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Faiyaz Mohammed <redacted>
quoted hunk ↗ jump to hunk
@@ -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
+	}
+
+	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;
+}
+
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help