public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Nick Piggin <npiggin@suse.de>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm] select_bad_process: cleanup 'releasing' check
Date: Mon, 28 Aug 2006 19:00:03 +0400	[thread overview]
Message-ID: <20060828150003.GA6321@oleg> (raw)
In-Reply-To: <20060828104459.GA14010@wotan.suse.de>

On 08/28, Nick Piggin wrote:
>
> On Sun, Aug 27, 2006 at 10:25:38PM +0400, Oleg Nesterov wrote:
> > 
> > -		releasing = test_tsk_thread_flag(p, TIF_MEMDIE) ||
> > -						p->flags & PF_EXITING;
> > -		if (releasing) {
> > -			if (p->flags & PF_EXITING && p == current) {
> > -				chosen = p;
> > -				*ppoints = ULONG_MAX;
> > -				break;
> > -			}
> > -			return ERR_PTR(-1UL);
> > -		}
> > +		if ((p->flags & PF_EXITING) && p == current) {
> > +			chosen = p;
> > +			*ppoints = ULONG_MAX;
> > +			break;
> > +		}
> > +		if ((p->flags & PF_EXITING) ||
> > +				test_tsk_thread_flag(p, TIF_MEMDIE))
> > +			return ERR_PTR(-1UL);
> > +
> 
> Hmm, actually I think I spot a bug in the original logic: we don't want
> to have more than 1 task with TIF_MEMDIE at once, becaues that gives it
> access to memory reserves (but I saw it first in the new formulation, so
> maybe that does suggest it is more readable ;)
> 
> What I think should be done is the check for TIF_MEMDIE (and return -1)
> first, and then the PF_EXITING test. At which point, if current is found to
> be exiting, it should be chosen but not break... that way a subsequent MEMDIE
> or EXITING task has the chance to trigger the -1 return.

Aha! The logic looked somewhat strange to me, but ...

> Anyway, if you don't want to do all that, I will when my hand gets better.

I have little understanding of this magic, i'd better not to try to fix it.

> Otherwise the 3 patches you sent look good, they could all have an
> 
> Acked-by: Nick Piggin <npiggin@suse.de>

Thanks!

Oleg.


      reply	other threads:[~2006-08-28 11:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-27 18:25 [PATCH -mm] select_bad_process: cleanup 'releasing' check Oleg Nesterov
2006-08-28 10:44 ` Nick Piggin
2006-08-28 15:00   ` 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=20060828150003.GA6321@oleg \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    /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