diff options
author | Shaohua Li <shli@kernel.org> | 2013-07-31 21:56:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-11 21:35:25 -0400 |
commit | 73b8bd6de83c0ca182622f83d31a1b0a137281fe (patch) | |
tree | 65705b3f47ece784f160278c2b73eb32fe60e057 /kernel/workqueue.c | |
parent | fa2446744dd5a99a3938aad9faade9b8928aec48 (diff) |
workqueue: copy workqueue_attrs with all fields
commit 2865a8fb44cc32420407362cbda80c10fa09c6b2 upstream.
$echo '0' > /sys/bus/workqueue/devices/xxx/numa
$cat /sys/bus/workqueue/devices/xxx/numa
I got 1. It should be 0, the reason is copy_workqueue_attrs() called
in apply_workqueue_attrs() doesn't copy no_numa field.
Fix it by making copy_workqueue_attrs() copy ->no_numa too. This
would also make get_unbound_pool() set a pool's ->no_numa attribute
according to the workqueue attributes used when the pool was created.
While harmelss, as ->no_numa isn't a pool attribute, this is a bit
confusing. Clear it explicitly.
tj: Updated description and comments a bit.
Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index ee8e29a2320c..6f019219ddbd 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -3398,6 +3398,12 @@ static void copy_workqueue_attrs(struct workqueue_attrs *to, | |||
3398 | { | 3398 | { |
3399 | to->nice = from->nice; | 3399 | to->nice = from->nice; |
3400 | cpumask_copy(to->cpumask, from->cpumask); | 3400 | cpumask_copy(to->cpumask, from->cpumask); |
3401 | /* | ||
3402 | * Unlike hash and equality test, this function doesn't ignore | ||
3403 | * ->no_numa as it is used for both pool and wq attrs. Instead, | ||
3404 | * get_unbound_pool() explicitly clears ->no_numa after copying. | ||
3405 | */ | ||
3406 | to->no_numa = from->no_numa; | ||
3401 | } | 3407 | } |
3402 | 3408 | ||
3403 | /* hash value of the content of @attr */ | 3409 | /* hash value of the content of @attr */ |
@@ -3565,6 +3571,12 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs) | |||
3565 | lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */ | 3571 | lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */ |
3566 | copy_workqueue_attrs(pool->attrs, attrs); | 3572 | copy_workqueue_attrs(pool->attrs, attrs); |
3567 | 3573 | ||
3574 | /* | ||
3575 | * no_numa isn't a worker_pool attribute, always clear it. See | ||
3576 | * 'struct workqueue_attrs' comments for detail. | ||
3577 | */ | ||
3578 | pool->attrs->no_numa = false; | ||
3579 | |||
3568 | /* if cpumask is contained inside a NUMA node, we belong to that node */ | 3580 | /* if cpumask is contained inside a NUMA node, we belong to that node */ |
3569 | if (wq_numa_enabled) { | 3581 | if (wq_numa_enabled) { |
3570 | for_each_node(node) { | 3582 | for_each_node(node) { |