mirror of
https://github.com/drasko/codezero.git
synced 2026-04-22 11:49:05 +02:00
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:
@@ -201,11 +201,11 @@ void sched_resume_sync(struct ktcb *task)
|
|||||||
/*
|
/*
|
||||||
* Asynchronously resumes a task.
|
* Asynchronously resumes a task.
|
||||||
* The task will run in the future, but at
|
* 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)
|
void sched_resume_async(struct ktcb *task)
|
||||||
{
|
{
|
||||||
BUG_ON(task == current);
|
|
||||||
task->state = TASK_RUNNABLE;
|
task->state = TASK_RUNNABLE;
|
||||||
sched_rq_add_task(task, rq_runnable, RQ_ADD_FRONT);
|
sched_rq_add_task(task, rq_runnable, RQ_ADD_FRONT);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user