I’m studying the linux-3.2.9 kernel, and in sched_rt.c function pick_next_highest_task_rt() there is a for loop that looks at all the rt_rq’s to find the (next) highest task. But I’m puzzled by this “if” condition:
for_each-leaf_rt-rq(rt_rq, rq)
....
if (next && next->prio < idx)
continue;
here, next is a task_struct * if one has already been found, and idx is the highest priority (lower numerical value) on the current rt_rq. In the above code, if next->prio == idx, then the if condition will fail and we will go and scan the current rt_rq. But I think this would be a waste of time, since the highest priority task we would find would have priority idx, which is the same priority as the task pointed to by next. So shouldn’t the if condition be:
if (next && next->prio <= idx)
continue;
??
Thanks,
Michael
It looks like a small bug; please take to kernel mailing list. Accompany it with a patch and you could be famous. 🙂