Commit fefdd336b2a2f7617e0c8a0777c731d9ed6454ae

Authored by Catalin Marinas
1 parent 0587da40be

kmemleak: Show the age of an unreferenced object

The jiffies shown for unreferenced objects isn't always meaningful to
people debugging kernel memory leaks. This patch adds the age as well to
the displayed information.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -346,11 +346,13 @@
346 346 struct kmemleak_object *object)
347 347 {
348 348 int i;
  349 + unsigned int msecs_age = jiffies_to_msecs(jiffies - object->jiffies);
349 350  
350 351 seq_printf(seq, "unreferenced object 0x%08lx (size %zu):\n",
351 352 object->pointer, object->size);
352   - seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu\n",
353   - object->comm, object->pid, object->jiffies);
  353 + seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu (age %d.%03ds)\n",
  354 + object->comm, object->pid, object->jiffies,
  355 + msecs_age / 1000, msecs_age % 1000);
354 356 hex_dump_object(seq, object);
355 357 seq_printf(seq, " backtrace:\n");
356 358