* [PATCH] slub: Trace free objects at KERN_INFO
@ 2017-01-13 15:48 Daniel Thompson
2017-01-14 20:53 ` Christoph Lameter
2017-01-18 1:49 ` David Rientjes
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Thompson @ 2017-01-13 15:48 UTC (permalink / raw)
To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
Andrew Morton
Cc: Daniel Thompson, linux-mm, linux-kernel, patches
Currently when trace is enabled (e.g. slub_debug=T,kmalloc-128 ) the
trace messages are mostly output at KERN_INFO. However the trace code
also calls print_section() to hexdump the head of a free object. This
is hard coded to use KERN_ERR, meaning the console is deluged with
trace messages even if we've asked for quiet.
Fix this the obvious way but adding a level parameter to
print_section(), allowing calls from the trace code to use the same
trace level as other trace messages.
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
mm/slub.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 067598a00849..7aa6f433f4de 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -496,10 +496,11 @@ static inline int check_valid_pointer(struct kmem_cache *s,
return 1;
}
-static void print_section(char *text, u8 *addr, unsigned int length)
+static void print_section(char *level, char *text, u8 *addr,
+ unsigned int length)
{
metadata_access_enable();
- print_hex_dump(KERN_ERR, text, DUMP_PREFIX_ADDRESS, 16, 1, addr,
+ print_hex_dump(level, text, DUMP_PREFIX_ADDRESS, 16, 1, addr,
length, 1);
metadata_access_disable();
}
@@ -636,14 +637,15 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
p, p - addr, get_freepointer(s, p));
if (s->flags & SLAB_RED_ZONE)
- print_section("Redzone ", p - s->red_left_pad, s->red_left_pad);
+ print_section(KERN_ERR, "Redzone ", p - s->red_left_pad,
+ s->red_left_pad);
else if (p > addr + 16)
- print_section("Bytes b4 ", p - 16, 16);
+ print_section(KERN_ERR, "Bytes b4 ", p - 16, 16);
- print_section("Object ", p, min_t(unsigned long, s->object_size,
- PAGE_SIZE));
+ print_section(KERN_ERR, "Object ", p,
+ min_t(unsigned long, s->object_size, PAGE_SIZE));
if (s->flags & SLAB_RED_ZONE)
- print_section("Redzone ", p + s->object_size,
+ print_section(KERN_ERR, "Redzone ", p + s->object_size,
s->inuse - s->object_size);
if (s->offset)
@@ -658,7 +660,8 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
if (off != size_from_object(s))
/* Beginning of the filler is the free pointer */
- print_section("Padding ", p + off, size_from_object(s) - off);
+ print_section(KERN_ERR, "Padding ", p + off,
+ size_from_object(s) - off);
dump_stack();
}
@@ -820,7 +823,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
end--;
slab_err(s, page, "Padding overwritten. 0x%p-0x%p", fault, end - 1);
- print_section("Padding ", end - remainder, remainder);
+ print_section(KERN_ERR, "Padding ", end - remainder, remainder);
restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end);
return 0;
@@ -973,7 +976,7 @@ static void trace(struct kmem_cache *s, struct page *page, void *object,
page->freelist);
if (!alloc)
- print_section("Object ", (void *)object,
+ print_section(KERN_INFO, "Object ", (void *)object,
s->object_size);
dump_stack();
--
2.9.3
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] slub: Trace free objects at KERN_INFO
2017-01-13 15:48 [PATCH] slub: Trace free objects at KERN_INFO Daniel Thompson
@ 2017-01-14 20:53 ` Christoph Lameter
2017-01-18 1:49 ` David Rientjes
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Lameter @ 2017-01-14 20:53 UTC (permalink / raw)
To: Daniel Thompson
Cc: Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton,
linux-mm, linux-kernel, patches
Acked-by: Christoph Lameter <cl@linux.com>
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] slub: Trace free objects at KERN_INFO
2017-01-13 15:48 [PATCH] slub: Trace free objects at KERN_INFO Daniel Thompson
2017-01-14 20:53 ` Christoph Lameter
@ 2017-01-18 1:49 ` David Rientjes
1 sibling, 0 replies; 3+ messages in thread
From: David Rientjes @ 2017-01-18 1:49 UTC (permalink / raw)
To: Daniel Thompson
Cc: Christoph Lameter, Pekka Enberg, Joonsoo Kim, Andrew Morton,
linux-mm, linux-kernel, patches
On Fri, 13 Jan 2017, Daniel Thompson wrote:
> Currently when trace is enabled (e.g. slub_debug=T,kmalloc-128 ) the
> trace messages are mostly output at KERN_INFO. However the trace code
> also calls print_section() to hexdump the head of a free object. This
> is hard coded to use KERN_ERR, meaning the console is deluged with
> trace messages even if we've asked for quiet.
>
> Fix this the obvious way but adding a level parameter to
> print_section(), allowing calls from the trace code to use the same
> trace level as other trace messages.
>
> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: David Rientjes <rientjes@google.com>
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-18 1:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 15:48 [PATCH] slub: Trace free objects at KERN_INFO Daniel Thompson
2017-01-14 20:53 ` Christoph Lameter
2017-01-18 1:49 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox