Commit 2c638ab0 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] scheduler fixes, 2.5.32-BK

This adds two scheduler related fixes:

 - changes the migration code to use struct completion. Andrew pointed out
   that there might be a small window in where the up() touches the
   semaphore while the waiting task goes on and frees its stack. And
   completion is more suited for this kind of stuff anyway.

 - removes two unneeded exports, pointed out by Andrew.
parent 1f9d6582
......@@ -496,8 +496,6 @@ EXPORT_SYMBOL(loops_per_jiffy);
#endif
EXPORT_SYMBOL(kstat);
EXPORT_SYMBOL(nr_running);
EXPORT_SYMBOL(nr_context_switches);
/* misc */
EXPORT_SYMBOL(panic);
......
......@@ -1901,7 +1901,7 @@ void __init init_idle(task_t *idle, int cpu)
typedef struct {
list_t list;
task_t *task;
struct semaphore sem;
struct completion done;
} migration_req_t;
/*
......@@ -1945,13 +1945,13 @@ void set_cpus_allowed(task_t *p, unsigned long new_mask)
task_rq_unlock(rq, &flags);
goto out;
}
init_MUTEX_LOCKED(&req.sem);
init_completion(&req.done);
req.task = p;
list_add(&req.list, &rq->migration_queue);
task_rq_unlock(rq, &flags);
wake_up_process(rq->migration_thread);
down(&req.sem);
wait_for_completion(&req.done);
out:
preempt_enable();
}
......@@ -2032,7 +2032,7 @@ static int migration_thread(void * data)
double_rq_unlock(rq_src, rq_dest);
local_irq_restore(flags);
up(&req->sem);
complete(&req->done);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment