From: Domen Puncer <domen@coderock.org>
To: Ingo Molnar <mingo@elte.hu>
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 13:07:23 +0100 [thread overview]
Message-ID: <20041120120722.GA3826@masina.coderock.org> (raw)
In-Reply-To: <20041120125355.GB8091@elte.hu>
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)
Well, it just looks more readable to me. But i don't have too strong
feelings about this. :-)
Domen
next prev parent reply other threads:[~2004-11-20 12:12 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 [this message]
2004-11-20 16:40 ` Ingo Molnar
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=20041120120722.GA3826@masina.coderock.org \
--to=domen@coderock.org \
--cc=akpm@osdl.org \
--cc=janitor@sternwelten.at \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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