Removed an overly restrictive BUG_ON assert from scheduler code.

sched_resume_async() used to forbit current tasks to wake up themselves
since it seems tasks can never be runnable to wake themselves up. However
there's a special case in the scheduler where a task that is about to sleep
may notice it has a pending event and wake itself up asynchronously. Since
all sleeping preparation has already been done and scheduler code is a safe
zone, it is safe to undo it all and resume about-to-sleep task in the scheduler.

We may want to put a BKPT in the pager's suspend routine if it waits for the
sleeping task to resume itself, to see if such a wait is successful. It rarely happens.
This commit is contained in:
Bahadir Balban
2008-11-07 21:25:36 +02:00
parent 99b7cf2274
commit 0e3f069713

View File

@@ -201,11 +201,11 @@ void sched_resume_sync(struct ktcb *task)
/*
* Asynchronously resumes a task.
* The task will run in the future, but at
* the scheduler's discretion.
* the scheduler's discretion. It is possible that current
* task wakes itself up via this function in the scheduler().
*/
void sched_resume_async(struct ktcb *task)
{
BUG_ON(task == current);
task->state = TASK_RUNNABLE;
sched_rq_add_task(task, rq_runnable, RQ_ADD_FRONT);
}