[lkml]   [2003]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectHow to schedule idle_task?

I am trying to force idle_task in schedule() but could not get it to work.
Here is my requirement: I would like the scheduler to prevent any task
with low priority (meaning lower than a cutoff point) from being scheduled
to run, even if there are no high priority tasks running (when this
happens, idle_task should be scheduled to run). They (the low priority
tasks) have to wait until their dynamic priorities boosted to be able to

So here is what I added to schedule():

* Default process to select..
next = idle_task(this_cpu);
c = -1000;
list_for_each(tmp, &runqueue_head) {
p = list_entry(tmp, struct task_struct, run_list);
if (can_schedule(p, this_cpu)) {
int weight = goodness(p, this_cpu, prev->active_mm);
if (weight > c)
c = weight, next = p;

// This is what I added:

if((c > 2) && (c < CUTOFF_PRIORITY)) {
//printk("LOW PRIORITY PROCESS (%d)\n", c);
next = idle_task(this_cpu);

// End

/* Do we need to re-calculate counters? */
if (unlikely(!c))

The problem is that once the idle_task is forced to run, no other tasks
can be scheduled again, and the system hangs, even if there is another
high priority task running. And if I uncomment the printk statement, the
message is printed repeatly.

So the question is, how do I do this properly so that high priority tasks
can still run?

btw, the kernel version is 2.4.21



To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:47    [W:4.066 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site