[2/3] kmemleak: add checksum to backtrace report

Message ID 20230425222446.170486-3-jim.cromie@gmail.com
State New
Headers
Series kmemleak report format changes |

Commit Message

Jim Cromie April 25, 2023, 10:24 p.m. UTC
  change kmemleak report format:

from: "  backtrace:"
to:   "  backtrace (ck <cksum>):"

The <cksum> allows a user to see recurring backtraces without
detailed/careful reading of multiline backtraces.  So after cycling
kmemleak-test a few times, I know some leaks are repeating.

  bash-5.2# grep backtrace /sys/kernel/debug/kmemleak | wc
     62     186    1792
  bash-5.2# grep backtrace /sys/kernel/debug/kmemleak | sort -u | wc
     37     111    1067

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 mm/kmemleak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index f025c7bc845b..2d1dfed4293d 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -362,7 +362,7 @@  static void print_unreferenced(struct seq_file *seq,
 	warn_or_seq_printf(seq, "  comm \"%s\", pid %d, jiffies %lu\n",
 			   object->comm, object->pid, object->jiffies);
 	hex_dump_object(seq, object);
-	warn_or_seq_printf(seq, "  backtrace:\n");
+	warn_or_seq_printf(seq, "  backtrace (ck %u):\n", object->checksum);
 
 	for (i = 0; i < nr_entries; i++) {
 		void *ptr = (void *)entries[i];