Hi.
This test was depending on TASK_RUNNING being defined as 0.
Signed-off-by: Domen Puncer <[email protected]>
Signed-off-by: Maximilian Attems <[email protected]>
---
linux-2.6.10-rc2-bk4-max/kernel/sched.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
diff -puN kernel/sched.c~fix-test-kernel_sched kernel/sched.c
--- linux-2.6.10-rc2-bk4/kernel/sched.c~fix-test-kernel_sched 2004-11-20 03:04:46.000000000 +0100
+++ linux-2.6.10-rc2-bk4-max/kernel/sched.c 2004-11-20 03:04:46.000000000 +0100
@@ -2576,7 +2576,8 @@ need_resched_nonpreemptible:
* to picking the next task.
*/
switch_count = &prev->nivcsw;
- if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
+ if (prev->state != TASK_RUNNING &&
+ !(preempt_count() & PREEMPT_ACTIVE)) {
switch_count = &prev->nvcsw;
if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&
unlikely(signal_pending(prev))))
_
* [email protected] <[email protected]> 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.
Ingo
On 20/11/04 13:53 +0100, Ingo Molnar wrote:
>
> * [email protected] <[email protected]> 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
* Domen Puncer <[email protected]> wrote:
> On 20/11/04 13:53 +0100, Ingo Molnar wrote:
> >
> > * [email protected] <[email protected]> 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