History

workqueue: copy workqueue_attrs with all fields

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

Shaohua Li committed 13 years ago

Commit 2865a8f1 parent c2fda501 file · +12 −0Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+12−0
@@ -3416,6 +3416,12 @@ static void copy_workqueue_attrs(struct workqueue_attrs *to, · 3415 unmodified lines
34163416 {
34173417 to->nice = from->nice;
34183418 cpumask_copy(to->cpumask, from->cpumask);
3419+ /*
3420+ * Unlike hash and equality test, this function doesn't ignore
3421+ * ->no_numa as it is used for both pool and wq attrs. Instead,
3422+ * get_unbound_pool() explicitly clears ->no_numa after copying.
3423+ */
3424+ to->no_numa = from->no_numa;
34193425 }
34203426
34213427 /* hash value of the content of @attr */
@@ -3583,6 +3589,12 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs) · 161 unmodified lines
35833589 lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */
35843590 copy_workqueue_attrs(pool->attrs, attrs);
35853591
3592+ /*
3593+ * no_numa isn't a worker_pool attribute, always clear it. See
3594+ * 'struct workqueue_attrs' comments for detail.
3595+ */
3596+ pool->attrs->no_numa = false;
3597+
35863598 /* if cpumask is contained inside a NUMA node, we belong to that node */
35873599 if (wq_numa_enabled) {
35883600 for_each_node(node) {