lkml.org 
[lkml]   [2009]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] process wide itimer cruft
On 02/03, Peter Zijlstra wrote:
>
> ->live -- the number of associated tasks,
> ->count -- not quite a refcount?

No, ->count is not a refcount.

Basically, ->count means how many threads didn't pass release_task() yet.
Well, actually __exit_signal(), but this doesn't matter. The thread becomes
"really dead" after that. Until then, it is still visible to, say,
find_task_by_vpid, signals, etc.

But if we have a zombie group leader, it may stay zombie "forever", and
->count doesn't go to zero. So we also have signal->live, when it is zero
we know that all sub-threads at least entered do_exit(). For example,
we can safely do exit_itimers() when ->live == 0, no other thread can
do sys_timer_create() (or any syscall of course).

> Could you shed a bit of light on the distinction between sighand and
> signal?

->signal is protected by ->sighand->siglock, and they both cleared
"atomically" under ->siglock in __exit_signal. I guess, the only
reason for 2 structures is CLONE_SIGHAND which can be used without
CLONE_THREAD.

Now, let's look at arch/ia64/kernel/ptrace.c:ptrace_attach_sync_user_rbs()

read_lock(&tasklist_lock);
if (child->signal) {
... this task is alive, we can proceed ...
This is correct, but if we want to make ->signal refcountable, we
should turn the above check into

if (child->sighand) {
This is the same, but allows use to never clear task->signal.

I'll try to send the patch which does this today, we should also
change posix-cpu-timers.c and thats all, if my grepping was right.

> > I think we really need another counter, at least for now.
>
> Don't rush on my account, Ingo's proposed solution doesn't need this.

OK.

Oleg.



\
 
 \ /
  Last update: 2009-02-03 19:27    [W:0.080 / U:0.732 seconds]
©2003-2014 Jasper Spaans. Advertise on this site