Re: Scheduling bug for SCHED_FIFO and SCHED_RR
On Fri, 20 Apr 2001, Nigel Gamble wrote: > A SCHED_FIFO or SCHED_RR task with priority n+1 will not preempt a > running task with priority n. You need to give the higher priority task > a priority of at least n+2 for it to be chosen by the scheduler. > > The problem is caused by reschedule_idle(), uniprocessor version: > > if (preemption_goodness(tsk, p, this_cpu) > 1) > tsk->need_resched = 1; > > For real-time scheduling to work correctly, need_resched should be set > whenever preemption_goodness() is greater than 0, not 1. This bug is also in the SMP version of reschedule_idle(). The corresponding fix (against 2.4.3-ac14) is: --- 2.4.3-ac14/kernel/sched.c Tue Apr 24 18:40:15 2001 +++ linux/kernel/sched.cTue Apr 24 18:41:32 2001 @@ -246,7 +246,7 @@ */ oldest_idle = (cycles_t) -1; target_tsk = NULL; - max_prio = 1; + max_prio = 0; for (i = 0; i < smp_num_cpus; i++) { cpu = cpu_logical_map(i); Nigel Gamble[EMAIL PROTECTED] Mountain View, CA, USA. http://www.nrg.org/ MontaVista Software [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Scheduling bug for SCHED_FIFO and SCHED_RR
On Fri, 20 Apr 2001, Nigel Gamble wrote: A SCHED_FIFO or SCHED_RR task with priority n+1 will not preempt a running task with priority n. You need to give the higher priority task a priority of at least n+2 for it to be chosen by the scheduler. The problem is caused by reschedule_idle(), uniprocessor version: if (preemption_goodness(tsk, p, this_cpu) 1) tsk-need_resched = 1; For real-time scheduling to work correctly, need_resched should be set whenever preemption_goodness() is greater than 0, not 1. This bug is also in the SMP version of reschedule_idle(). The corresponding fix (against 2.4.3-ac14) is: --- 2.4.3-ac14/kernel/sched.c Tue Apr 24 18:40:15 2001 +++ linux/kernel/sched.cTue Apr 24 18:41:32 2001 @@ -246,7 +246,7 @@ */ oldest_idle = (cycles_t) -1; target_tsk = NULL; - max_prio = 1; + max_prio = 0; for (i = 0; i smp_num_cpus; i++) { cpu = cpu_logical_map(i); Nigel Gamble[EMAIL PROTECTED] Mountain View, CA, USA. http://www.nrg.org/ MontaVista Software [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Scheduling bug for SCHED_FIFO and SCHED_RR
A SCHED_FIFO or SCHED_RR task with priority n+1 will not preempt a running task with priority n. You need to give the higher priority task a priority of at least n+2 for it to be chosen by the scheduler. The problem is caused by reschedule_idle(), uniprocessor version: if (preemption_goodness(tsk, p, this_cpu) > 1) tsk->need_resched = 1; For real-time scheduling to work correctly, need_resched should be set whenever preemption_goodness() is greater than 0, not 1. Here is a patch against 2.4.3: --- 2.4.3/kernel/sched.cThu Apr 19 15:03:21 2001 +++ linux/kernel/sched.cFri Apr 20 16:45:07 2001 @@ -290,7 +290,7 @@ struct task_struct *tsk; tsk = cpu_curr(this_cpu); - if (preemption_goodness(tsk, p, this_cpu) > 1) + if (preemption_goodness(tsk, p, this_cpu) > 0) tsk->need_resched = 1; #endif } Nigel Gamble[EMAIL PROTECTED] Mountain View, CA, USA. http://www.nrg.org/ MontaVista Software [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Scheduling bug for SCHED_FIFO and SCHED_RR
A SCHED_FIFO or SCHED_RR task with priority n+1 will not preempt a running task with priority n. You need to give the higher priority task a priority of at least n+2 for it to be chosen by the scheduler. The problem is caused by reschedule_idle(), uniprocessor version: if (preemption_goodness(tsk, p, this_cpu) 1) tsk-need_resched = 1; For real-time scheduling to work correctly, need_resched should be set whenever preemption_goodness() is greater than 0, not 1. Here is a patch against 2.4.3: --- 2.4.3/kernel/sched.cThu Apr 19 15:03:21 2001 +++ linux/kernel/sched.cFri Apr 20 16:45:07 2001 @@ -290,7 +290,7 @@ struct task_struct *tsk; tsk = cpu_curr(this_cpu); - if (preemption_goodness(tsk, p, this_cpu) 1) + if (preemption_goodness(tsk, p, this_cpu) 0) tsk-need_resched = 1; #endif } Nigel Gamble[EMAIL PROTECTED] Mountain View, CA, USA. http://www.nrg.org/ MontaVista Software [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/