aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2019-03-07 19:29:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-07 21:32:01 -0500
commit4b0470027528ba98f9617f4ceba328de71d2fe49 (patch)
tree396305027606c8acc1418ac9d2475b5a370aa9ff /kernel/workqueue.c
parent6eb3c3d0a52dca337e327ae8868ca1f44a712e02 (diff)
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: Johannes Weiner <hannes@cmpxchg.org> Suggested-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 56814902bc56..d51c37dd9422 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -920,6 +920,16 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task)
920 * CONTEXT: 920 * CONTEXT:
921 * spin_lock_irq(rq->lock) 921 * spin_lock_irq(rq->lock)
922 * 922 *
923 * This function is called during schedule() when a kworker is going
924 * to sleep. It's used by psi to identify aggregation workers during
925 * dequeuing, to allow periodic aggregation to shut-off when that
926 * worker is the last task in the system or cgroup to go to sleep.
927 *
928 * As this function doesn't involve any workqueue-related locking, it
929 * only returns stable values when called from inside the scheduler's
930 * queuing and dequeuing paths, when @task, which must be a kworker,
931 * is guaranteed to not be processing any works.
932 *
923 * Return: 933 * Return:
924 * The last work function %current executed as a worker, NULL if it 934 * The last work function %current executed as a worker, NULL if it
925 * hasn't executed any work yet. 935 * hasn't executed any work yet.