[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090203182240.GA19079@redhat.com>
Date: Tue, 3 Feb 2009 19:22:40 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "Zhang, Yanmin" <yanmin_zhang@...ux.intel.com>,
Lin Ming <ming.m.lin@...el.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists