summaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2017-01-24 18:18:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-24 19:26:14 -0500
commitaa2efd5ea4041754da4046c3d2e7edaac9526258 (patch)
treee10a9bc10ac113baf513117c22d50c98c606fb61 /mm/slub.c
parent15a77c6fe494f4b1757d30cd137fe66ab06a38c3 (diff)
mm/slub.c: trace free objects at KERN_INFO
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. Link: http://lkml.kernel.org/r/20170113154850.518-1-daniel.thompson@linaro.org Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Christoph Lameter <cl@linux.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c23
1 files 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,
496 return 1; 496 return 1;
497} 497}
498 498
499static void print_section(char *text, u8 *addr, unsigned int length) 499static void print_section(char *level, char *text, u8 *addr,
500 unsigned int length)
500{ 501{
501 metadata_access_enable(); 502 metadata_access_enable();
502 print_hex_dump(KERN_ERR, text, DUMP_PREFIX_ADDRESS, 16, 1, addr, 503 print_hex_dump(level, text, DUMP_PREFIX_ADDRESS, 16, 1, addr,
503 length, 1); 504 length, 1);
504 metadata_access_disable(); 505 metadata_access_disable();
505} 506}
@@ -636,14 +637,15 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
636 p, p - addr, get_freepointer(s, p)); 637 p, p - addr, get_freepointer(s, p));
637 638
638 if (s->flags & SLAB_RED_ZONE) 639 if (s->flags & SLAB_RED_ZONE)
639 print_section("Redzone ", p - s->red_left_pad, s->red_left_pad); 640 print_section(KERN_ERR, "Redzone ", p - s->red_left_pad,
641 s->red_left_pad);
640 else if (p > addr + 16) 642 else if (p > addr + 16)
641 print_section("Bytes b4 ", p - 16, 16); 643 print_section(KERN_ERR, "Bytes b4 ", p - 16, 16);
642 644
643 print_section("Object ", p, min_t(unsigned long, s->object_size, 645 print_section(KERN_ERR, "Object ", p,
644 PAGE_SIZE)); 646 min_t(unsigned long, s->object_size, PAGE_SIZE));
645 if (s->flags & SLAB_RED_ZONE) 647 if (s->flags & SLAB_RED_ZONE)
646 print_section("Redzone ", p + s->object_size, 648 print_section(KERN_ERR, "Redzone ", p + s->object_size,
647 s->inuse - s->object_size); 649 s->inuse - s->object_size);
648 650
649 if (s->offset) 651 if (s->offset)
@@ -658,7 +660,8 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
658 660
659 if (off != size_from_object(s)) 661 if (off != size_from_object(s))
660 /* Beginning of the filler is the free pointer */ 662 /* Beginning of the filler is the free pointer */
661 print_section("Padding ", p + off, size_from_object(s) - off); 663 print_section(KERN_ERR, "Padding ", p + off,
664 size_from_object(s) - off);
662 665
663 dump_stack(); 666 dump_stack();
664} 667}
@@ -820,7 +823,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
820 end--; 823 end--;
821 824
822 slab_err(s, page, "Padding overwritten. 0x%p-0x%p", fault, end - 1); 825 slab_err(s, page, "Padding overwritten. 0x%p-0x%p", fault, end - 1);
823 print_section("Padding ", end - remainder, remainder); 826 print_section(KERN_ERR, "Padding ", end - remainder, remainder);
824 827
825 restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end); 828 restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end);
826 return 0; 829 return 0;
@@ -973,7 +976,7 @@ static void trace(struct kmem_cache *s, struct page *page, void *object,
973 page->freelist); 976 page->freelist);
974 977
975 if (!alloc) 978 if (!alloc)
976 print_section("Object ", (void *)object, 979 print_section(KERN_INFO, "Object ", (void *)object,
977 s->object_size); 980 s->object_size);
978 981
979 dump_stack(); 982 dump_stack();