public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>,
	Lin Ming <ming.m.lin@intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC] process wide itimer cruft
Date: Tue, 3 Feb 2009 19:22:40 +0100	[thread overview]
Message-ID: <20090203182240.GA19079@redhat.com> (raw)
In-Reply-To: <1233683499.10184.45.camel@laptop>

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.


      reply	other threads:[~2009-02-03 18:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-01  7:30 hackbench [pthread mode] regression with 2.6.29-rc3 Zhang, Yanmin
     [not found] ` <d3f22a0902010026q1db36381j36cb1c9803d48431@mail.gmail.com>
2009-02-01  8:29   ` Lin Ming
2009-02-01  9:17     ` Peter Zijlstra
2009-02-01  9:57       ` Peter Zijlstra
2009-02-01 10:04         ` Ingo Molnar
2009-02-02  1:12         ` Zhang, Yanmin
2009-02-02  8:53           ` Peter Zijlstra
2009-02-02 17:49             ` Bryon Roche
2009-02-02 20:50               ` Peter Zijlstra
2009-02-03 11:56             ` [RFC] process wide itimer cruft Peter Zijlstra
2009-02-03 17:23               ` Oleg Nesterov
2009-02-03 17:51                 ` Peter Zijlstra
2009-02-03 18:22                   ` Oleg Nesterov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090203182240.GA19079@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox