提交 e50aba9a 编写于 作者: T Tejun Heo

workqueue: use NUMA-aware allocation for pool_workqueues

Use kmem_cache_alloc_node() with @pool->node instead of
kmem_cache_zalloc() when allocating a pool_workqueue so that it's
allocated on the same node as the associated worker_pool.  As there's
no no kmem_cache_zalloc_node(), move zeroing to init_pwq().

This was suggested by Lai Jiangshan.
Signed-off-by: NTejun Heo <tj@kernel.org>
Reviewed-by: NLai Jiangshan <laijs@cn.fujitsu.com>
上级 f147f29e
...@@ -3626,12 +3626,14 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) ...@@ -3626,12 +3626,14 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq)
spin_unlock_irq(&pwq->pool->lock); spin_unlock_irq(&pwq->pool->lock);
} }
/* initialize newly zalloced @pwq which is associated with @wq and @pool */ /* initialize newly alloced @pwq which is associated with @wq and @pool */
static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq, static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq,
struct worker_pool *pool) struct worker_pool *pool)
{ {
BUG_ON((unsigned long)pwq & WORK_STRUCT_FLAG_MASK); BUG_ON((unsigned long)pwq & WORK_STRUCT_FLAG_MASK);
memset(pwq, 0, sizeof(*pwq));
pwq->pool = pool; pwq->pool = pool;
pwq->wq = wq; pwq->wq = wq;
pwq->flush_color = -1; pwq->flush_color = -1;
...@@ -3677,7 +3679,7 @@ static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *wq, ...@@ -3677,7 +3679,7 @@ static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *wq,
if (!pool) if (!pool)
return NULL; return NULL;
pwq = kmem_cache_zalloc(pwq_cache, GFP_KERNEL); pwq = kmem_cache_alloc_node(pwq_cache, GFP_KERNEL, pool->node);
if (!pwq) { if (!pwq) {
put_unbound_pool(pool); put_unbound_pool(pool);
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册