基于 3.10.90 内核代码
在 kernel\sched\core.c 里, 对于 __schedule 有如下注释:
/*
* __schedule() is the main scheduler function.
*
* The main means of driving the scheduler and thus entering this function are:
*
* 1. Explicit blocking: mutex, semaphore, waitqueue, etc.
* (1) mutext:
* mutex_lock --> might_sleep --> might_resched --> 定义了 CONFIG_PREEMPT_VOLUNTARY ,则 _cond_resched
* --> if (should_resched()) __cond_resched() --> __schedule
* (2) semaphore:
* void down(struct semaphore *sem) --> __down --> __down_common --> schedule_timeout --> schedule
* void up(struct semaphore *sem) --> __up --> wake_up_process --> try_to_wake_up --> ttwu_queue
* --> ttwu_do_activate --> ttwu_do_wakeup --> check_preempt_curr
* --> resched_task(rq->curr); --> set_tsk_need_resched 没有
linux arm 进程调度时机
最新推荐文章于 2024-09-08 21:15:30 发布