public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Domen Puncer <domen@coderock.org>
Cc: janitor@sternwelten.at, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: kernel/sched.c: fix subtle TASK_RUNNING compare
Date: Sat, 20 Nov 2004 17:40:11 +0100	[thread overview]
Message-ID: <20041120164011.GA13360@elte.hu> (raw)
In-Reply-To: <20041120120722.GA3826@masina.coderock.org>


* Domen Puncer <domen@coderock.org> wrote:

> On 20/11/04 13:53 +0100, Ingo Molnar wrote:
> > 
> > * janitor@sternwelten.at <janitor@sternwelten.at> wrote:
> > 
> > >  	switch_count = &prev->nivcsw;
> > > -	if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
> > > +	if (prev->state != TASK_RUNNING &&
> > > +			!(preempt_count() & PREEMPT_ACTIVE)) {
> > >  		switch_count = &prev->nvcsw;
> > 
> > nack. We inherently rely on the process state mask being a bitmask and
> > TASK_RUNNING thus being zero.
> 
> Hmm... but other compares in sched.c are ok? ;-)
> 1211:   BUG_ON(p->state != TASK_RUNNING);
> 2550:   if (unlikely(current == rq->idle) && current->state != TASK_RUNNING) {
> 3609:   if (state == TASK_RUNNING)
> 3640:   if (state != TASK_RUNNING)

hm ... ok.

	Ingo

      reply	other threads:[~2004-11-20 15:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-20  2:29 [patch 3/8] kernel/sched.c: fix subtle TASK_RUNNING compare janitor
2004-11-20 12:53 ` Ingo Molnar
2004-11-20 12:07   ` Domen Puncer
2004-11-20 16:40     ` Ingo Molnar [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=20041120164011.GA13360@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=domen@coderock.org \
    --cc=janitor@sternwelten.at \
    --cc=linux-kernel@vger.kernel.org \
    /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