[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210901051914.971603-3-imran.f.khan@oracle.com>
Date: Wed, 1 Sep 2021 15:19:14 +1000
From: Imran Khan <imran.f.khan@...cle.com>
To: geert@...ux-m68k.org, vbabka@...e.cz, akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org
Subject: [RFC PATCH 2/2] lib, stackdepot: Add helper to print stack entries.
To print a stack entries, users of stackdepot, first
use stack_depot_fetch to get a list of stack entries
and then use stack_trace_print to print this list.
Provide a helper in stackdepot to print stack entries
based on stackdepot handle.
Signed-off-by: Imran Khan <imran.f.khan@...cle.com>
Suggested-by: Vlastimil Babka <vbabka@...e.cz>
---
lib/stackdepot.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index 1d42ef9ef766..eab4476b060b 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -214,6 +214,23 @@ static inline struct stack_record *find_stack(struct stack_record *bucket,
return NULL;
}
+/**
+ * stack_depot_print - print stack entries from a depot
+ *
+ * @handle: Stack depot handle which was returned from
+ * stack_depot_save().
+ *
+ */
+void stack_depot_print(depot_stack_handle_t stack)
+{
+ unsigned long *entries;
+ unsigned int nr_entries;
+
+ nr_entries = stack_depot_fetch(stack, &entries);
+ stack_trace_print(entries, nr_entries, 0);
+}
+EXPORT_SYMBOL_GPL(stack_depot_print);
+
/**
* stack_depot_fetch - Fetch stack entries from a depot
*
--
2.30.2
Powered by blists - more mailing lists