LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [PATCH wq/for-3.19 2/3] workqueue: keep track of the flushing task and pool manager
Date: Mon, 8 Dec 2014 12:44:06 -0500 [thread overview]
Message-ID: <20141208174406.GC12274@htj.dyndns.org> (raw)
In-Reply-To: <20141208174326.GB12274@htj.dyndns.org>
Add wq_barrier->task and worker_pool->manager to keep track of the
flushing task and pool manager respectively. These are purely
informational and will be used to implement sysrq dump of workqueues.
Signed-off-by: Tejun Heo <tj@kernel.org>
---
kernel/workqueue.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -159,6 +159,7 @@ struct worker_pool {
/* see manage_workers() for details on the two manager mutexes */
struct mutex manager_arb; /* manager arbitration */
+ struct worker *manager; /* L: purely informational */
struct mutex attach_mutex; /* attach/detach exclusion */
struct list_head workers; /* A: attached workers */
struct completion *detach_completion; /* all workers detached */
@@ -1927,9 +1928,11 @@ static bool manage_workers(struct worker
*/
if (!mutex_trylock(&pool->manager_arb))
return ret;
+ pool->manager = worker;
ret |= maybe_create_worker(pool);
+ pool->manager = NULL;
mutex_unlock(&pool->manager_arb);
return ret;
}
@@ -2319,6 +2322,7 @@ repeat:
struct wq_barrier {
struct work_struct work;
struct completion done;
+ struct task_struct *task; /* purely informational */
};
static void wq_barrier_func(struct work_struct *work)
@@ -2367,6 +2371,7 @@ static void insert_wq_barrier(struct poo
INIT_WORK_ONSTACK(&barr->work, wq_barrier_func);
__set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work));
init_completion(&barr->done);
+ barr->task = current;
/*
* If @target is currently being executed, schedule the
next prev parent reply other threads:[~2014-12-08 17:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-08 17:43 [PATCH wq/for-3.19 1/3] workqueue: make the workqueues list RCU walkable Tejun Heo
2014-12-08 17:44 ` Tejun Heo [this message]
2014-12-08 17:47 ` [PATCH wq/for-3.19 3/3] workqueue: dump workqueues on sysrq-t Tejun Heo
2014-12-08 18:06 ` Andrew Morton
2014-12-08 18:40 ` Tejun Heo
2014-12-08 19:05 ` Andrew Morton
2014-12-08 19:22 ` Tejun Heo
2014-12-10 4:50 ` Greg Kroah-Hartman
2014-12-10 18:34 ` Tejun Heo
2015-03-09 13:28 ` [PATCH v3 " Tejun Heo
2015-03-10 12:58 ` 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=20141208174406.GC12274@htj.dyndns.org \
--to=tj@kernel.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [PATCH wq/for-3.19 2/3] workqueue: keep track of the flushing task and pool manager' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).