diff options
author | Peter Zijlstra <peterz@infradead.org> | 2016-10-19 15:45:27 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-10-25 11:27:56 +0200 |
commit | a225023828038a1aaea876a65313c863ec23fa44 (patch) | |
tree | b409d383912f8fd9cfc17c048aacb5c782b423b9 /kernel/sched | |
parent | sched/fair: Kill the unused 'sched_shares_window_ns' tunable (diff) | |
download | linux-a225023828038a1aaea876a65313c863ec23fa44.tar.xz linux-a225023828038a1aaea876a65313c863ec23fa44.zip |
sched/core: Explain sleep/wakeup in a better way
There were a few questions wrt. how sleep-wakeup works. Try and explain
it more.
Requested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/core.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 94732d1ab00a..b8c86ba44ca9 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1995,14 +1995,15 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags) * @state: the mask of task states that can be woken * @wake_flags: wake modifier flags (WF_*) * - * Put it on the run-queue if it's not already there. The "current" - * thread is always on the run-queue (except when the actual - * re-schedule is in progress), and as such you're allowed to do - * the simpler "current->state = TASK_RUNNING" to mark yourself - * runnable without the overhead of this. - * - * Return: %true if @p was woken up, %false if it was already running. - * or @state didn't match @p's state. + * If (@state & @p->state) @p->state = TASK_RUNNING. + * + * If the task was not queued/runnable, also place it back on a runqueue. + * + * Atomic against schedule() which would dequeue a task, also see + * set_current_state(). + * + * Return: %true if @p->state changes (an actual wakeup was done), + * %false otherwise. */ static int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) |