lkml.org 
[lkml]   [2010]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/5] workqueue: implement workqueue_on_rescuer()
Date
workqueue_on_rescuer() tests whether the caller is running on the
rescuer of the specified workqueue.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
include/linux/workqueue.h | 1 +
kernel/workqueue.c | 15 +++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f11100f..c988063 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -339,6 +339,7 @@ extern int cancel_work_sync(struct work_struct *work);
extern void workqueue_set_max_active(struct workqueue_struct *wq,
int max_active);
extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq);
+extern bool workqueue_on_rescuer(struct workqueue_struct *wq);
extern unsigned int work_cpu(struct work_struct *work);
extern unsigned int work_busy(struct work_struct *work);

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 727f24e..a91e1ca 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2941,6 +2941,21 @@ bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq)
EXPORT_SYMBOL_GPL(workqueue_congested);

/**
+ * workqueue_on_rescuer - test whether executing on the rescuer
+ * @wq: target workqueue
+ *
+ * Test whether the caller is currently executing on @wq's rescuer.
+ *
+ * RETURNS:
+ * %true if executing on @wq's rescuer, %false otherwise.
+ */
+bool workqueue_on_rescuer(struct workqueue_struct *wq)
+{
+ return wq->rescuer && current == wq->rescuer->task;
+}
+EXPORT_SYMBOL_GPL(workqueue_on_rescuer);
+
+/**
* work_cpu - return the last known associated cpu for @work
* @work: the work of interest
*
--
1.7.1


\
 
 \ /
  Last update: 2010-09-06 14:49    [W:0.087 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site