mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Ingo Molnar <mingo@elte.hu>,
	"Paul E. McKenney" <paulmck@us.ibm.com>,
	Andrew Morton <akpm@osdl.org>, Lee Revell <rlrevell@joe-job.com>
Subject: Re: [PATCH rc1-mm 2/3] coredump: shutdown current process first
Date: Mon, 10 Apr 2006 00:08:40 -0700 (PDT)	[thread overview]
Message-ID: <20060410070840.26AE41809D1@magilla.sf.frob.com> (raw)
In-Reply-To: Oleg Nesterov's message of  Sunday, 9 April 2006 04:11:27 +0400 <20060409001127.GA101@oleg>

> This patch optimize zap_threads() for the case when there are
> no ->mm users except the current's thread group. In that case
> we can avoid 'for_each_process()' loop.

This is a very good optimization.  Please don't use a goto here when a
simple if block and some reindenting works just fine.

I would be inclined to restructure the inner loop something like this:

		p = g;
		while (unlikely(p->mm == NULL)) {
			p = next_thread(p);
			if (p == g)
				break;
		}
		if (p->mm == mm) {
			/*
			 * p->sighand can't disappear, but
			 * may be changed by de_thread()
			 */
			lock_task_sighand(p, &flags);
			zap_process(p);
			unlock_task_sighand(p, &flags);
		}

But that is just taste.

> It also adds a useful invariant: SIGNAL_GROUP_EXIT (if checked
> under ->siglock) always implies that all threads (except may be
> current) have pending SIGKILL.

I agree that's a sensible thing to be able to rely on (though I don't know
of a practical difference it makes atm).  If this is merged with by
SIGNAL_GROUP_EXEC change, then the invariant is that SIGNAL_GROUP_EXIT
always means that all threads (including current) either have pending
SIGKILL or are already calling do_group_exit/do_exit.


Thanks,
Roland

  reply	other threads:[~2006-04-10  7:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-09  0:11 Oleg Nesterov
2006-04-10  7:08 ` Roland McGrath [this message]
2006-04-10 14:01   ` Oleg Nesterov
2006-04-14  8:04     ` Eric W. Biederman
2006-04-14 15:33       ` Oleg Nesterov
2006-04-14 17:02         ` Eric W. Biederman
2006-06-09 17:24 ` [PATCH] 2.6.17-rc4 bugfix with initramfs Nickolay
2006-06-10  7:07   ` Sam Ravnborg

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=20060410070840.26AE41809D1@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=paulmck@us.ibm.com \
    --cc=rlrevell@joe-job.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

Powered by JetHome