From af6e996d593c67ae68893ec0c7e30898db4e28e0 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 12 Mar 2013 17:41:37 -0700 Subject: [PATCH] --- yaml --- r: 365509 b: refs/heads/master c: e62676169118bc2d42e5008b3f8872646313f077 h: refs/heads/master i: 365507: 9565de6d1e9b10c42484fd636a8c6a96f2e44db3 v: v3 --- [refs] | 2 +- trunk/include/linux/workqueue.h | 1 + trunk/kernel/workqueue.c | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 9ec76e91ff35..1bbf15931ac3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 226223ab3c4118ddd10688cc2c131135848371ab +refs/heads/master: e62676169118bc2d42e5008b3f8872646313f077 diff --git a/trunk/include/linux/workqueue.h b/trunk/include/linux/workqueue.h index 7f6d29a417c0..df30763c8682 100644 --- a/trunk/include/linux/workqueue.h +++ b/trunk/include/linux/workqueue.h @@ -451,6 +451,7 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork); extern void workqueue_set_max_active(struct workqueue_struct *wq, int max_active); +extern bool current_is_workqueue_rescuer(void); extern bool workqueue_congested(int cpu, struct workqueue_struct *wq); extern unsigned int work_busy(struct work_struct *work); diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index c82feac0a878..f5c8bbb9ada3 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/kernel/workqueue.c @@ -4071,6 +4071,19 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active) } EXPORT_SYMBOL_GPL(workqueue_set_max_active); +/** + * current_is_workqueue_rescuer - is %current workqueue rescuer? + * + * Determine whether %current is a workqueue rescuer. Can be used from + * work functions to determine whether it's being run off the rescuer task. + */ +bool current_is_workqueue_rescuer(void) +{ + struct worker *worker = current_wq_worker(); + + return worker && worker == worker->current_pwq->wq->rescuer; +} + /** * workqueue_congested - test whether a workqueue is congested * @cpu: CPU in question