Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 680e58e7 authored by Johannes Weiner's avatar Johannes Weiner Committed by Patrick Daly
Browse files

kernel: workqueue: clarify wq_worker_last_func() caller requirements

This function can only be called safely from very specific scheduler
contexts.  Document those.

Link: http://lkml.kernel.org/r/20190206150528.31198-1-hannes@cmpxchg.org


Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Suggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Change-Id: Iba9616c0193affb09f04daa59efb5a76f8d8f637
Git-commit: 4b0470027528ba98f9617f4ceba328de71d2fe49
Git-repo: https://source.codeaurora.org/quic/la/kernel/msm


Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent ab214458
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -920,6 +920,16 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task)
 * CONTEXT:
 * spin_lock_irq(rq->lock)
 *
 * This function is called during schedule() when a kworker is going
 * to sleep. It's used by psi to identify aggregation workers during
 * dequeuing, to allow periodic aggregation to shut-off when that
 * worker is the last task in the system or cgroup to go to sleep.
 *
 * As this function doesn't involve any workqueue-related locking, it
 * only returns stable values when called from inside the scheduler's
 * queuing and dequeuing paths, when @task, which must be a kworker,
 * is guaranteed to not be processing any works.
 *
 * Return:
 * The last work function %current executed as a worker, NULL if it
 * hasn't executed any work yet.