* + mm-kfence-print-the-elapsed-time-for-allocated-freed-track.patch added to mm-unstable branch
@ 2024-08-07 21:05 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-08-07 21:05 UTC (permalink / raw)
To: mm-commits, qiwu.chen, elver, dvyukov, qiwuchen55, akpm
The patch titled
Subject: mm: kfence: print the elapsed time for allocated/freed track
has been added to the -mm mm-unstable branch. Its filename is
mm-kfence-print-the-elapsed-time-for-allocated-freed-track.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-kfence-print-the-elapsed-time-for-allocated-freed-track.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: "qiwu.chen" <qiwuchen55@gmail.com>
Subject: mm: kfence: print the elapsed time for allocated/freed track
Date: Wed, 7 Aug 2024 10:56:27 +0800
Print the elapsed time for the allocated or freed track, which can be
useful in some debugging scenarios.
Link: https://lkml.kernel.org/r/20240807025627.37419-1-qiwu.chen@transsion.com
Signed-off-by: qiwu.chen <qiwu.chen@transsion.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: chenqiwu <qiwu.chen@transsion.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/kfence/report.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/mm/kfence/report.c~mm-kfence-print-the-elapsed-time-for-allocated-freed-track
+++ a/mm/kfence/report.c
@@ -16,6 +16,7 @@
#include <linux/sprintf.h>
#include <linux/stacktrace.h>
#include <linux/string.h>
+#include <linux/sched/clock.h>
#include <trace/events/error_report.h>
#include <asm/kfence.h>
@@ -108,11 +109,14 @@ static void kfence_print_stack(struct se
const struct kfence_track *track = show_alloc ? &meta->alloc_track : &meta->free_track;
u64 ts_sec = track->ts_nsec;
unsigned long rem_nsec = do_div(ts_sec, NSEC_PER_SEC);
+ u64 interval_nsec = local_clock() - meta->alloc_track.ts_nsec;
+ unsigned long rem_interval_nsec = do_div(interval_nsec, NSEC_PER_SEC);
/* Timestamp matches printk timestamp format. */
- seq_con_printf(seq, "%s by task %d on cpu %d at %lu.%06lus:\n",
+ seq_con_printf(seq, "%s by task %d on cpu %d at %lu.%06lus (%lu.%06lus ago):\n",
show_alloc ? "allocated" : "freed", track->pid,
- track->cpu, (unsigned long)ts_sec, rem_nsec / 1000);
+ track->cpu, (unsigned long)ts_sec, rem_nsec / 1000,
+ (unsigned long)interval_nsec, rem_interval_nsec / 1000);
if (track->num_stack_entries) {
/* Skip allocation/free internals stack. */
_
Patches currently in -mm which might be from qiwuchen55@gmail.com are
mm-kfence-print-the-elapsed-time-for-allocated-freed-track.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-08-07 21:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 21:05 + mm-kfence-print-the-elapsed-time-for-allocated-freed-track.patch added to mm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.