diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/core.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index fbf1fd098dc6..c9a3655e572d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -3367,6 +3367,40 @@ pick_next_task(struct rq *rq) | |||
| 3367 | 3367 | ||
| 3368 | /* | 3368 | /* |
| 3369 | * __schedule() is the main scheduler function. | 3369 | * __schedule() is the main scheduler function. |
| 3370 | * | ||
| 3371 | * The main means of driving the scheduler and thus entering this function are: | ||
| 3372 | * | ||
| 3373 | * 1. Explicit blocking: mutex, semaphore, waitqueue, etc. | ||
| 3374 | * | ||
| 3375 | * 2. TIF_NEED_RESCHED flag is checked on interrupt and userspace return | ||
| 3376 | * paths. For example, see arch/x86/entry_64.S. | ||
| 3377 | * | ||
| 3378 | * To drive preemption between tasks, the scheduler sets the flag in timer | ||
| 3379 | * interrupt handler scheduler_tick(). | ||
| 3380 | * | ||
| 3381 | * 3. Wakeups don't really cause entry into schedule(). They add a | ||
| 3382 | * task to the run-queue and that's it. | ||
| 3383 | * | ||
| 3384 | * Now, if the new task added to the run-queue preempts the current | ||
| 3385 | * task, then the wakeup sets TIF_NEED_RESCHED and schedule() gets | ||
| 3386 | * called on the nearest possible occasion: | ||
| 3387 | * | ||
| 3388 | * - If the kernel is preemptible (CONFIG_PREEMPT=y): | ||
| 3389 | * | ||
| 3390 | * - in syscall or exception context, at the next outmost | ||
| 3391 | * preempt_enable(). (this might be as soon as the wake_up()'s | ||
| 3392 | * spin_unlock()!) | ||
| 3393 | * | ||
| 3394 | * - in IRQ context, return from interrupt-handler to | ||
| 3395 | * preemptible context | ||
| 3396 | * | ||
| 3397 | * - If the kernel is not preemptible (CONFIG_PREEMPT is not set) | ||
| 3398 | * then at the next: | ||
| 3399 | * | ||
| 3400 | * - cond_resched() call | ||
| 3401 | * - explicit schedule() call | ||
| 3402 | * - return from syscall or exception to user-space | ||
| 3403 | * - return from interrupt-handler to user-space | ||
| 3370 | */ | 3404 | */ |
| 3371 | static void __sched __schedule(void) | 3405 | static void __sched __schedule(void) |
| 3372 | { | 3406 | { |
