lkml.org 
[lkml]   [2014]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/4] workqueue: add warning if pool->node is offline
Add warning if pool->node is offline.

This patch was originaly made for debug.
I think add warning here can show what may happen.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
kernel/workqueue.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f6cb357c..35f4f00 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -760,6 +760,15 @@ static bool too_many_workers(struct worker_pool *pool)
return nr_idle > 2 && (nr_idle - 2) * MAX_IDLE_WORKERS_RATIO >= nr_busy;
}

+/* Check pool->node */
+static int pool_to_node(struct worker_pool *pool)
+{
+ if (WARN_ON_ONCE(pool->node != NUMA_NO_NODE
+ && !node_online(pool->node)))
+ return NUMA_NO_NODE;
+ return pool->node;
+}
+
/*
* Wake up functions.
*/
@@ -1679,7 +1688,7 @@ static struct worker *create_worker(struct worker_pool *pool)
if (id < 0)
goto fail;

- worker = alloc_worker(pool->node);
+ worker = alloc_worker(pool_to_node(pool));
if (!worker)
goto fail;

@@ -1692,7 +1701,8 @@ static struct worker *create_worker(struct worker_pool *pool)
else
snprintf(id_buf, sizeof(id_buf), "u%d:%d", pool->id, id);

- worker->task = kthread_create_on_node(worker_thread, worker, pool->node,
+ worker->task = kthread_create_on_node(worker_thread, worker,
+ pool_to_node(pool),
"kworker/%s", id_buf);
if (IS_ERR(worker->task))
goto fail;
@@ -3651,7 +3661,7 @@ static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *wq,
if (!pool)
return NULL;

- pwq = kmem_cache_alloc_node(pwq_cache, GFP_KERNEL, pool->node);
+ pwq = kmem_cache_alloc_node(pwq_cache, GFP_KERNEL, pool_to_node(pool));
if (!pwq) {
put_unbound_pool(pool);
return NULL;
--
1.8.3.1




\
 
 \ /
  Last update: 2014-12-13 18:01    [W:0.247 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site