Skip to contentSkip to conversation

slub: extend slub debug to handle multiple slabs

PATCH In review Aaron Tomlin 2 participants 2 messages Sep 28, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 slub: extend slub debug to handle multiple slabs

Extend the slub_debug syntax to "slub_debug=<flags>[,<slub>]*", where <slub> may contain an asterisk at the end. For example, the following would poison all kmalloc slabs:

slub_debug=P,kmalloc*

and the following would apply the default flags to all kmalloc and all block IO slabs:

slub_debug=,bio*,kmalloc*

Please note that a similar patch was posted by Iliyan Malchev some time ago but was never merged:

	https://marc.info/?l=linux-mm&m=131283905330474&w=2

---
Changes from v2 [2]:

- Add a function and kernel-doc comment
- Refactor code
- Use the appropriate helper function max_t()

Changes from v1 [1]:

- Add appropriate cast to address compiler warning

[1]: https://marc.info/?l=linux-kernel&m=153657804506284&w=2
[2]: https://marc.info/?l=linux-kernel&m=153747362316965&w=2

---
 Documentation/vm/slub.rst | 12 +++++++++---
 mm/slub.c                 | 50 +++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 53 insertions(+), 9 deletions(-)
Documentation/vm/slub.rst +9 -3
index 3a775fd64e2d..195928808bac 100644
@@ -36,9 +36,10 @@ debugging is enabled. Format:
 
 slub_debug=<Debug-Options>
 	Enable options for all slabs
-slub_debug=<Debug-Options>,<slab name>
-	Enable options only for select slabs
 
+slub_debug=<Debug-Options>,<slab name1>,<slab name2>,...
+	Enable options only for select slabs (no spaces
+	after a comma)
 
 Possible debug options are::
 
@@ -62,7 +63,12 @@ Trying to find an issue in the dentry cache? Try::
 
 	slub_debug=,dentry
 
-to only enable debugging on the dentry cache.
+to only enable debugging on the dentry cache.  You may use an asterisk at the
+end of the slab name, in order to cover all slabs with the same prefix.  For
+example, here's how you can poison the dentry cache as well as all kmalloc
+slabs:
+
+	slub_debug=P,kmalloc-*,dentry
 
 Red zoning and tracking may realign the slab.  We can just apply sanity checks
 to the dentry cache with::
mm/slub.c +44 -6

60 lines not on this page · raw message

Signature · 1 line
2.14.4