lkml.org 
[lkml]   [2019]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC patch 16/41] tracing: Remove the ULONG_MAX stack trace hackery
On Wed, 10 Apr 2019 21:34:25 -0500
Josh Poimboeuf <jpoimboe@redhat.com> wrote:

> > --- a/kernel/trace/trace_stack.c
> > +++ b/kernel/trace/trace_stack.c
> > @@ -18,8 +18,7 @@
> >
> > #include "trace.h"
> >
> > -static unsigned long stack_dump_trace[STACK_TRACE_ENTRIES+1] =
> > - { [0 ... (STACK_TRACE_ENTRIES)] = ULONG_MAX };
> > +static unsigned long stack_dump_trace[STACK_TRACE_ENTRIES + 1];
>
> Is the "+ 1" still needed? AFAICT, accesses to this array never go past
> nr_entries.

Probably not. But see this for an explanation:

http://lkml.kernel.org/r/20180620110758.crunhd5bfep7zuiz@kili.mountain


>
> Also I've been staring at the code but I can't figure out why
> max_entries is "- 1".
>
> struct stack_trace stack_trace_max = {
> .max_entries = STACK_TRACE_ENTRIES - 1,
> .entries = &stack_dump_trace[0],
> };
>

Well, it had a reason in the past, but there doesn't seem to be a
reason today. Looking at git history, that code was originally:

.max_entries = STACK_TRACE_ENTRIES - 1,
.entries = &stack_dump_trace[1],

Where we had to make max_entries -1 as we started at the first index
into the array.

I'll have to take a new look into this code. After Thomas's clean up
here, I'm sure we can simplify it a bit more.

-- Steve

\
 
 \ /
  Last update: 2019-04-11 05:08    [W:0.076 / U:46.400 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site