* [PATCH 1/2] slub: extend slub_debug to handle multiple slabs
@ 2011-08-08 21:30 Iliyan Malchev
2011-08-13 6:58 ` Pekka Enberg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Iliyan Malchev @ 2011-08-08 21:30 UTC (permalink / raw)
To: Christoph Lameter, Pekka Enberg, Matt Mackall
Cc: linux-mm, linux-kernel, Iliyan Malchev
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*
Signed-off-by: Iliyan Malchev <malchev@google.com>
---
Documentation/vm/slub.txt | 12 +++++++++---
mm/slub.c | 32 +++++++++++++++++++++++++++++---
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/Documentation/vm/slub.txt b/Documentation/vm/slub.txt
index 07375e7..caa5b4a 100644
--- a/Documentation/vm/slub.txt
+++ b/Documentation/vm/slub.txt
@@ -31,8 +31,9 @@ Parameters may be given to slub_debug. If none is specified then full
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
F Sanity checks on (enables SLAB_DEBUG_FREE. Sorry
@@ -55,7 +56,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
diff --git a/mm/slub.c b/mm/slub.c
index eb5a8f9..8e7a282 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1275,9 +1275,35 @@ static unsigned long kmem_cache_flags(unsigned long objsize,
/*
* Enable debugging if selected on the kernel commandline.
*/
- if (slub_debug && (!slub_debug_slabs ||
- !strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs))))
- flags |= slub_debug;
+
+ char *end, *n, *glob;
+ int len = strlen(name);
+
+ /* If slub_debug = 0, it folds into the if conditional. */
+ if (!slub_debug_slabs)
+ return flags | slub_debug;
+
+ n = slub_debug_slabs;
+ while (*n) {
+ int cmplen;
+
+ end = strchr(n, ',');
+ if (!end)
+ end = n + strlen(n);
+
+ glob = strnchr(n, end - n, '*');
+ if (glob)
+ cmplen = glob - n;
+ else
+ cmplen = max(len, end - n);
+
+ if (!strncmp(name, n, cmplen)) {
+ flags |= slub_debug;
+ break;
+ }
+
+ n = *end ? end + 1 : end;
+ }
return flags;
}
--
1.7.3.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] slub: extend slub_debug to handle multiple slabs
2011-08-08 21:30 [PATCH 1/2] slub: extend slub_debug to handle multiple slabs Iliyan Malchev
@ 2011-08-13 6:58 ` Pekka Enberg
2011-08-15 13:55 ` Christoph Lameter
2012-01-23 13:16 ` Pekka Enberg
2 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2011-08-13 6:58 UTC (permalink / raw)
To: Iliyan Malchev
Cc: Christoph Lameter, Matt Mackall, linux-mm, linux-kernel,
David Rientjes
On Mon, 2011-08-08 at 14:30 -0700, Iliyan Malchev wrote:
> 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*
>
> Signed-off-by: Iliyan Malchev <malchev@google.com>
Christoph, David, are you OK with the patches? They look reasonable to
me.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] slub: extend slub_debug to handle multiple slabs
2011-08-08 21:30 [PATCH 1/2] slub: extend slub_debug to handle multiple slabs Iliyan Malchev
2011-08-13 6:58 ` Pekka Enberg
@ 2011-08-15 13:55 ` Christoph Lameter
2012-01-23 13:16 ` Pekka Enberg
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2011-08-15 13:55 UTC (permalink / raw)
To: Iliyan Malchev; +Cc: Pekka Enberg, Matt Mackall, linux-mm, linux-kernel
On Mon, 8 Aug 2011, Iliyan Malchev wrote:
> 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*
The use of the star suggests that general regexps will be working. But
this is only allowing a star at the end. It is explained later. So maybe
that ok.
> + n = slub_debug_slabs;
> + while (*n) {
> + int cmplen;
> +
> + end = strchr(n, ',');
> + if (!end)
> + end = n + strlen(n);
> +
> + glob = strnchr(n, end - n, '*');
> + if (glob)
> + cmplen = glob - n;
> + else
> + cmplen = max(len, end - n);
> +
> + if (!strncmp(name, n, cmplen)) {
> + flags |= slub_debug;
> + break;
> + }
> +
> + n = *end ? end + 1 : end;
Ugg.. Confusing
How about
if (!*end)
break;
n = end + 1;
or make the while loop into a for loop?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] slub: extend slub_debug to handle multiple slabs
2011-08-08 21:30 [PATCH 1/2] slub: extend slub_debug to handle multiple slabs Iliyan Malchev
2011-08-13 6:58 ` Pekka Enberg
2011-08-15 13:55 ` Christoph Lameter
@ 2012-01-23 13:16 ` Pekka Enberg
2 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2012-01-23 13:16 UTC (permalink / raw)
To: Iliyan Malchev; +Cc: Christoph Lameter, Matt Mackall, linux-mm, linux-kernel
Hi Iliyan,
On Tue, Aug 9, 2011 at 12:30 AM, Iliyan Malchev <malchev@google.com> wrote:
> 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*
>
> Signed-off-by: Iliyan Malchev <malchev@google.com>
Ping? I didn't see followup patches that addressed Christoph's review
comments. I think the feature makes sense so it'd be good to have it
in mainline.
Pekka
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-23 13:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-08 21:30 [PATCH 1/2] slub: extend slub_debug to handle multiple slabs Iliyan Malchev
2011-08-13 6:58 ` Pekka Enberg
2011-08-15 13:55 ` Christoph Lameter
2012-01-23 13:16 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).