Commit 74b416367b4ea3aad7c4ff566345a4cf3cf5a80b

Authored by Daniel Thompson
Committed by Greg Kroah-Hartman
1 parent c1bb2a899b

mm/slub.c: trace free objects at KERN_INFO

commit aa2efd5ea4041754da4046c3d2e7edaac9526258 upstream.

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 13 additions and 10 deletions Side-by-side Diff

... ... @@ -496,10 +496,11 @@
496 496 return 1;
497 497 }
498 498  
499   -static void print_section(char *text, u8 *addr, unsigned int length)
  499 +static void print_section(char *level, char *text, u8 *addr,
  500 + unsigned int length)
500 501 {
501 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 504 length, 1);
504 505 metadata_access_disable();
505 506 }
506 507  
507 508  
508 509  
... ... @@ -636,14 +637,15 @@
636 637 p, p - addr, get_freepointer(s, p));
637 638  
638 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 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,
644   - PAGE_SIZE));
  645 + print_section(KERN_ERR, "Object ", p,
  646 + min_t(unsigned long, s->object_size, PAGE_SIZE));
645 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 649 s->inuse - s->object_size);
648 650  
649 651 if (s->offset)
... ... @@ -658,7 +660,8 @@
658 660  
659 661 if (off != size_from_object(s))
660 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 666 dump_stack();
664 667 }
... ... @@ -820,7 +823,7 @@
820 823 end--;
821 824  
822 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 828 restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end);
826 829 return 0;
... ... @@ -973,7 +976,7 @@
973 976 page->freelist);
974 977  
975 978 if (!alloc)
976   - print_section("Object ", (void *)object,
  979 + print_section(KERN_INFO, "Object ", (void *)object,
977 980 s->object_size);
978 981  
979 982 dump_stack();