diff options
author | Tejun Heo <tj@kernel.org> | 2013-03-12 20:41:37 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-03-12 20:42:01 -0400 |
commit | e62676169118bc2d42e5008b3f8872646313f077 (patch) | |
tree | 98ce7e6b03a8a18fa322de7997248a8e0b7b2f84 /kernel/workqueue.c | |
parent | 226223ab3c4118ddd10688cc2c131135848371ab (diff) |
workqueue: implement current_is_workqueue_rescuer()
Implement a function which queries whether it currently is running off
a workqueue rescuer. This will be used to convert writeback to
workqueue.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c82feac0a878..f5c8bbb9ada3 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -4072,6 +4072,19 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active) | |||
4072 | EXPORT_SYMBOL_GPL(workqueue_set_max_active); | 4072 | EXPORT_SYMBOL_GPL(workqueue_set_max_active); |
4073 | 4073 | ||
4074 | /** | 4074 | /** |
4075 | * current_is_workqueue_rescuer - is %current workqueue rescuer? | ||
4076 | * | ||
4077 | * Determine whether %current is a workqueue rescuer. Can be used from | ||
4078 | * work functions to determine whether it's being run off the rescuer task. | ||
4079 | */ | ||
4080 | bool current_is_workqueue_rescuer(void) | ||
4081 | { | ||
4082 | struct worker *worker = current_wq_worker(); | ||
4083 | |||
4084 | return worker && worker == worker->current_pwq->wq->rescuer; | ||
4085 | } | ||
4086 | |||
4087 | /** | ||
4075 | * workqueue_congested - test whether a workqueue is congested | 4088 | * workqueue_congested - test whether a workqueue is congested |
4076 | * @cpu: CPU in question | 4089 | * @cpu: CPU in question |
4077 | * @wq: target workqueue | 4090 | * @wq: target workqueue |