[Devel] Re: [PATCH 3/3] ftrace: add ability to only trace swapper tasks

Steven Rostedt rostedt at goodmis.org
Thu Dec 4 06:57:40 PST 2008


On Thu, 4 Dec 2008, Eric W. Biederman wrote:

> Steven Rostedt <rostedt at goodmis.org> writes:
> >
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 10b1d7c..eb57dc1 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -49,6 +49,7 @@ static int last_ftrace_enabled;
> >  
> >  /* set when tracing only a pid */
> >  struct pid *ftrace_pid_trace;
> > +static struct pid * const ftrace_swapper_pid = (struct pid *)1;
> 
> The initializer should be spelled &init_struct_pid instead of (struct pid *)1;
> 
> Except for the special case of finding this unhashed pid, by making the
> attach_pid(p, PIDTYPE_PID, pid) unconditional in copy_process, you can
> make the rest of the special cases go away.

Not that easy. It turns out that all idle tasks share the init_struct_pid, 
and if you add the attach_pid() outside the if statement, you only change 
the owner of the init_struct_pid to the last CPU to come on line.

I tried to allocate the pid, but by doing that it seems that the alloc_pid 
code will assign a number other than 0.  The changes needed to fork.c to 
make this work is quickly going beyond a trivial fix, where I do not want 
to become a pid container developer in order to implement it.

-- Steve

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list