diff options
author | Tejun Heo <tj@kernel.org> | 2013-04-01 14:23:35 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-04-01 14:23:35 -0400 |
commit | e50aba9aea63b7617887b4d9694184f478731c82 (patch) | |
tree | 68649f81762c3088c535d3bdb4743c2d96f6c7eb /kernel/workqueue.c | |
parent | f147f29eb7c4959e5f8be604ce2d23979c86378c (diff) |
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: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c8d047b6c895..07ec57459457 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -3626,12 +3626,14 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) | |||
3626 | spin_unlock_irq(&pwq->pool->lock); | 3626 | spin_unlock_irq(&pwq->pool->lock); |
3627 | } | 3627 | } |
3628 | 3628 | ||
3629 | /* initialize newly zalloced @pwq which is associated with @wq and @pool */ | 3629 | /* initialize newly alloced @pwq which is associated with @wq and @pool */ |
3630 | static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq, | 3630 | static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq, |
3631 | struct worker_pool *pool) | 3631 | struct worker_pool *pool) |
3632 | { | 3632 | { |
3633 | BUG_ON((unsigned long)pwq & WORK_STRUCT_FLAG_MASK); | 3633 | BUG_ON((unsigned long)pwq & WORK_STRUCT_FLAG_MASK); |
3634 | 3634 | ||
3635 | memset(pwq, 0, sizeof(*pwq)); | ||
3636 | |||
3635 | pwq->pool = pool; | 3637 | pwq->pool = pool; |
3636 | pwq->wq = wq; | 3638 | pwq->wq = wq; |
3637 | pwq->flush_color = -1; | 3639 | pwq->flush_color = -1; |
@@ -3677,7 +3679,7 @@ static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *wq, | |||
3677 | if (!pool) | 3679 | if (!pool) |
3678 | return NULL; | 3680 | return NULL; |
3679 | 3681 | ||
3680 | pwq = kmem_cache_zalloc(pwq_cache, GFP_KERNEL); | 3682 | pwq = kmem_cache_alloc_node(pwq_cache, GFP_KERNEL, pool->node); |
3681 | if (!pwq) { | 3683 | if (!pwq) { |
3682 | put_unbound_pool(pool); | 3684 | put_unbound_pool(pool); |
3683 | return NULL; | 3685 | return NULL; |