summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorIngo Molnar2018-03-09 07:32:20 +0100
committerIngo Molnar2018-03-09 07:32:20 +0100
commitfc4c5a3828bdba157f8ea406e1f4ceb75c13039c (patch)
treee3fc4601f914fa59e70c7534206cf5c2c6ba16d1 /kernel/workqueue.c
parentsched/core: Undefine tracepoint creation at the end of core.c (diff)
parentMerge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost (diff)
downloadkernel-qcow2-linux-fc4c5a3828bdba157f8ea406e1f4ceb75c13039c.tar.gz
kernel-qcow2-linux-fc4c5a3828bdba157f8ea406e1f4ceb75c13039c.tar.xz
kernel-qcow2-linux-fc4c5a3828bdba157f8ea406e1f4ceb75c13039c.zip
Merge branch 'linus' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 593dbe749174..f211a7bf0ca8 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4180,6 +4180,22 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active)
EXPORT_SYMBOL_GPL(workqueue_set_max_active);
/**
+ * current_work - retrieve %current task's work struct
+ *
+ * Determine if %current task is a workqueue worker and what it's working on.
+ * Useful to find out the context that the %current task is running in.
+ *
+ * Return: work struct if %current task is a workqueue worker, %NULL otherwise.
+ */
+struct work_struct *current_work(void)
+{
+ struct worker *worker = current_wq_worker();
+
+ return worker ? worker->current_work : NULL;
+}
+EXPORT_SYMBOL(current_work);
+
+/**
* current_is_workqueue_rescuer - is %current workqueue rescuer?
*
* Determine whether %current is a workqueue rescuer. Can be used from