Re: [PATCH] little schedule() cleanup: use cached current value

From: Oleg Nesterov
Date: Tue Nov 09 2004 - 08:27:28 EST


Ingo Molnar wrote:

> nack. We switch the kernel stack in switch_to() so 'next' here
> is the old task we switched to before we went off the CPU.

yes, sorry. here is corrected patch.

schedule() can use prev instead of get_current().

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>

--- 2.6.10-rc1/kernel/sched.c~ 2004-11-09 18:57:45.000000000 +0300
+++ 2.6.10-rc1/kernel/sched.c 2004-11-09 19:16:22.798486040 +0300
@@ -2508,7 +2508,7 @@ need_resched:
* The idle thread is not allowed to schedule!
* Remove this check after it has been exercised a bit.
*/
- if (unlikely(current == rq->idle) && current->state != TASK_RUNNING) {
+ if (unlikely(prev == rq->idle) && prev->state != TASK_RUNNING) {
printk(KERN_ERR "bad: scheduling from the idle thread!\n");
dump_stack();
}
@@ -2531,8 +2531,8 @@ need_resched:

spin_lock_irq(&rq->lock);

- if (unlikely(current->flags & PF_DEAD))
- current->state = EXIT_DEAD;
+ if (unlikely(prev->flags & PF_DEAD))
+ prev->state = EXIT_DEAD;
/*
* if entering off of a kernel preemption go straight
* to picking the next task.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/