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

From: Eric W. Biederman
Date: Fri Dec 05 2008 - 11:36:41 EST


Steven Rostedt <rostedt@xxxxxxxxxxx> writes:

> Other pids get allocated per task. In the beginning of copy_process we
> have:
>
> if (pid != &init_struct_pid) {
> retval = -ENOMEM;
> pid = alloc_pid(task_active_pid_ns(p));
>
> Where alloc_pid allocates a pid structure. But this is only done if it is
> not a swapper task.

For PIDTYPE_PID. For sessions and process groups we don't always allocate them,
and attach_pid is fine.

There is a bit of oddness in the pid freeing case, in using an unhashed pid,
so cpu hotunplug might be a problem. But you certainly shouldn't be running
into this.

>> > When doing the code you suggested, I end up with only marking the last
>> > idle task to be created.
>>
>> Odd. It is all a linked list through the task structures.
>> I'm guessing the initialization isn't quite right.
>>
>> Weird.
>
> Do I need to change the loop to do_each_pid_thread?

> I'll try that later today.

I don't think so. I'm pretty certain we aren't passing the necessary
clone flags to make that case work for idle threads, and in fact we aren't
even cloning from the idle task when we create additional idle threads
so I don't see how do_each_pid_thread could work better.

That said do_each_pid_thread appears to be a proper superset of
do_each_pid_task so it should not be harmful.

I am all for figuring out how to remove this special case if we can.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/