linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] workqueue: show the pool ID of the default pwq's pool in the pool_ids file
@ 2014-09-22  8:04 Lai Jiangshan
  2014-09-23 14:38 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Lai Jiangshan @ 2014-09-22  8:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lai Jiangshan, Tejun Heo

It seems incomplete if the pool_ids file doesn't include the default
pwq's pool.  Add it and the result:

# cat pool_ids 
0:9 1:10
default:8

rcu_read_lock_sched() is also changed to mutex_lock(&wq->mutex)
for accessing the default pwq.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 kernel/workqueue.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 5dbe22a..6af95210 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3004,7 +3004,7 @@ static ssize_t wq_pool_ids_show(struct device *dev,
 	const char *delim = "";
 	int node, written = 0;
 
-	rcu_read_lock_sched();
+	mutex_lock(&wq->mutex);
 	for_each_node(node) {
 		written += scnprintf(buf + written, PAGE_SIZE - written,
 				     "%s%d:%d", delim, node,
@@ -3012,7 +3012,9 @@ static ssize_t wq_pool_ids_show(struct device *dev,
 		delim = " ";
 	}
 	written += scnprintf(buf + written, PAGE_SIZE - written, "\n");
-	rcu_read_unlock_sched();
+	written += scnprintf(buf + written, PAGE_SIZE - written,
+			     "default:%d\n", wq->dfl_pwq->pool->id);
+	mutex_unlock(&wq->mutex);
 
 	return written;
 }
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] workqueue: show the pool ID of the default pwq's pool in the pool_ids file
  2014-09-22  8:04 [PATCH] workqueue: show the pool ID of the default pwq's pool in the pool_ids file Lai Jiangshan
@ 2014-09-23 14:38 ` Tejun Heo
  2014-09-24  0:50   ` Lai Jiangshan
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2014-09-23 14:38 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: linux-kernel

On Mon, Sep 22, 2014 at 04:04:37PM +0800, Lai Jiangshan wrote:
> It seems incomplete if the pool_ids file doesn't include the default
> pwq's pool.  Add it and the result:
> 
> # cat pool_ids 
> 0:9 1:10
> default:8

Hmmm?  default pwq is used only as the fallback if pool switching
fails and the failed nodes will have it assigned to them.  Why would
userland care about something which isn't being used?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] workqueue: show the pool ID of the default pwq's pool in the pool_ids file
  2014-09-23 14:38 ` Tejun Heo
@ 2014-09-24  0:50   ` Lai Jiangshan
  0 siblings, 0 replies; 3+ messages in thread
From: Lai Jiangshan @ 2014-09-24  0:50 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel

On 09/23/2014 10:38 PM, Tejun Heo wrote:
> On Mon, Sep 22, 2014 at 04:04:37PM +0800, Lai Jiangshan wrote:
>> It seems incomplete if the pool_ids file doesn't include the default
>> pwq's pool.  Add it and the result:
>>
>> # cat pool_ids 
>> 0:9 1:10
>> default:8
> 
> Hmmm?  default pwq is used only as the fallback if pool switching
> fails and the failed nodes will have it assigned to them.  Why would
> userland care about something which isn't being used?

Understood.

> 
> Thanks.
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-24  0:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22  8:04 [PATCH] workqueue: show the pool ID of the default pwq's pool in the pool_ids file Lai Jiangshan
2014-09-23 14:38 ` Tejun Heo
2014-09-24  0:50   ` Lai Jiangshan

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).