Messages in this thread Patch in this message | | | Date | Thu, 3 Dec 1998 14:00:43 +0100 (CET) | From | Andrea Arcangeli <> | Subject | idle_task priority and scheduling 2.1.131 |
| |
The SCHED_YIELD in 2.1.131 i386/kernel/process.c should really not help. This because the only place that care about SCHED_YIELD is goodness and goodness() should be never run on the idle_task. The reason for using idle_task->counter = -4 was to allow reschedule_idle() to wakeup immediatly a sleeping process if the current one is the idle_task (and this not achieved for sure using SCHED_YIELD).
This patch fix the idle_task priority/counter and an APM mistake:
Index: linux/arch/i386/kernel/process.c diff -u linux/arch/i386/kernel/process.c:1.1.1.3 linux/arch/i386/kernel/process.c:1.1.1.1.2.6 --- linux/arch/i386/kernel/process.c:1.1.1.3 Thu Dec 3 12:51:05 1998 +++ linux/arch/i386/kernel/process.c Thu Dec 3 13:48:03 1998 @@ -105,19 +105,27 @@ */ static int cpu_idle(void *unused) { - unsigned long start_idle = jiffies; + unsigned long start_time = 0; + int started = 0; /* endless idle loop with no priority at all */ + current->priority = 0; + /* counter must be -4 see reschedule_idle() in sched.c */ + current->counter = -4; for (;;) { - if (jiffies - start_idle > HARD_IDLE_TIMEOUT) + if (!started) + { + start_time = jiffies; + started = 1; + } + if (started && jiffies - start_time > HARD_IDLE_TIMEOUT) hard_idle(); else { if (boot_cpu_data.hlt_works_ok && !hlt_counter && !current->need_resched) __asm__("hlt"); } if (current->need_resched) - start_idle = jiffies; - current->policy = SCHED_YIELD; + started = 0; schedule(); check_pgt_cache(); } @@ -131,12 +139,13 @@ int cpu_idle(void *unused) { - /* endless idle loop with no priority at all */ + current->priority = 0; + /* counter must be -4 see reschedule_idle() in sched.c */ + current->counter = -4; while(1) { if (current_cpu_data.hlt_works_ok && !hlt_counter && !current->need_resched) __asm__("hlt"); - current->policy = SCHED_YIELD; schedule(); check_pgt_cache(); }
Andrea Arcangeli
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |