lkml.org 
[lkml]   [2019]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC patch 21/41] proc: Simplify task stack retrieval
Replace the indirection through struct stack_trace with an invocation of
the storage array based interface.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/proc/base.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -407,7 +407,6 @@ static void unlock_trace(struct task_str
static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
- struct stack_trace trace;
unsigned long *entries;
int err;

@@ -430,20 +429,16 @@ static int proc_pid_stack(struct seq_fil
if (!entries)
return -ENOMEM;

- trace.nr_entries = 0;
- trace.max_entries = MAX_STACK_TRACE_DEPTH;
- trace.entries = entries;
- trace.skip = 0;
-
err = lock_trace(task);
if (!err) {
- unsigned int i;
+ unsigned int i, nent;

- save_stack_trace_tsk(task, &trace);
+ nent = stack_trace_save_tsk(task, entries,
+ MAX_STACK_TRACE_DEPTH, 0);

- for (i = 0; i < trace.nr_entries; i++) {
+ for (i = 0; i < nent; i++)
seq_printf(m, "[<0>] %pB\n", (void *)entries[i]);
- }
+
unlock_trace(task);
}
kfree(entries);

\
 
 \ /
  Last update: 2019-04-10 13:06    [W:1.452 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site