From: Tejun Heo <tj@kernel.org>
To: jaxboe@fusionio.com, linux-kernel@vger.kernel.org, hch@lst.de
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 1/5] workqueue: implement workqueue_on_rescuer()
Date: Mon, 6 Sep 2010 14:46:18 +0200 [thread overview]
Message-ID: <1283777182-11426-2-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1283777182-11426-1-git-send-email-tj@kernel.org>
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
next prev parent reply other threads:[~2010-09-06 12:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-06 12:46 [PATCHSET] backing-dev: replace private thread pool with workqueue Tejun Heo
2010-09-06 12:46 ` Tejun Heo [this message]
2010-09-06 12:46 ` [PATCH 2/5] backing-dev: kill unused bdi_writeback->nr Tejun Heo
2010-09-08 8:57 ` Artem Bityutskiy
2010-09-06 12:46 ` [PATCH 3/5] backing-dev: replace private thread pool with workqueue Tejun Heo
2010-09-06 12:46 ` [PATCH 4/5] backing-dev: update trace points Tejun Heo
2010-09-06 12:46 ` [PATCH 5/5] backing-dev: replace sync_supers_tsk/timer with a delayed_work Tejun Heo
2010-09-08 9:00 ` Artem Bityutskiy
2010-09-07 12:16 ` [PATCHSET] backing-dev: replace private thread pool with workqueue Christoph Hellwig
2010-09-07 12:19 ` Tejun Heo
2010-09-07 12:29 ` Jens Axboe
2010-09-07 12:36 ` Tejun Heo
2010-11-27 16:02 ` Tejun Heo
2010-11-27 18:50 ` Jens Axboe
2010-11-27 20:30 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1283777182-11426-2-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=hch@lst.de \
--cc=jaxboe@fusionio.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.