Skip to contentSkip to conversation

slab: remove /proc/slab_allocators

PATCH In review Qian Cai 3 participants 3 messages May 16, 2019 – May 21, 2019

Subsystems (2)
lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH 1/1 slab: remove /proc/slab_allocators

It turned out that DEBUG_SLAB_LEAK is still broken even after recent recue efforts that when there is a large number of objects like kmemleak_object which is normal on a debug kernel,

  # grep kmemleak /proc/slabinfo
  kmemleak_object   2243606 3436210 ...

reading /proc/slab_allocators could easily loop forever while processing the kmemleak_object cache and any additional freeing or allocating objects will trigger a reprocessing. To make a situation worse, soft-lockups could easily happen in this sitatuion which will call printk() to allocate more kmemleak objects to guarantee an infinite loop.

Also, since it seems no one had noticed when it was totally broken more than 2-year ago - see the commit fcf88917dd43 ("slab: fix a crash by reading /proc/slab_allocators"), probably nobody cares about it anymore due to the decline of the SLAB. Just remove it entirely.

---
 include/linux/slab_def.h |   3 -
 lib/Kconfig.debug        |   4 -
 mm/slab.c                | 226 +----------------------------------------------
 3 files changed, 1 insertion(+), 232 deletions(-)
include/linux/slab_def.h +0 -3
index 9a5eafb7145b..abc7de77b988 100644
@@ -61,9 +61,6 @@ struct kmem_cache {
 	atomic_t allocmiss;
 	atomic_t freehit;
 	atomic_t freemiss;
-#ifdef CONFIG_DEBUG_SLAB_LEAK
-	atomic_t store_user_clean;
-#endif
 
 	/*
 	 * If debugging is enabled, then the allocator can add additional
lib/Kconfig.debug +0 -4
index fdfa173651eb..eae43952902e 100644
@@ -542,10 +542,6 @@ config DEBUG_SLAB
 	  allocation as well as poisoning memory on free to catch use of freed
 	  memory. This can make kmalloc/kfree-intensive workloads much slower.
 
-config DEBUG_SLAB_LEAK
-	bool "Memory leak debugging"
-	depends on DEBUG_SLAB
-
 config SLUB_DEBUG_ON
 	bool "SLUB debugging on by default"
 	depends on SLUB && SLUB_DEBUG
mm/slab.c +1 -225

251 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · Qian Cai

Also, since it seems no one had noticed when it was totally broken more than 2-year ago - see the commit fcf88917dd43 ("slab: fix a crash by reading /proc/slab_allocators"), probably nobody cares about it anymore due to the decline of the SLAB. Just remove it entirely.

With a diff summary like this:

 3 files changed, 1 insertion(+), 232 deletions(-)

I can not resist this patch, and have applied it. Thanks,

Linus