Skip to contentSkip to conversation

workqueue: Allow modifying low level unbound workqueue cpumask

PATCH Applied Lai Jiangshan 2 participants 2 messages Apr 30, 2015 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/1 workqueue: Allow modifying low level unbound workqueue cpumask

Allow to modify the low-level unbound workqueues cpumask through sysfs. This is performed by traversing the entire workqueue list and calling apply_wqattrs_prepare() on the unbound workqueues with the new low level mask. Only after all the preparation are done, we commit them all together.

Ordered workqueues are ignored from the low level unbound workqueue cpumask, it will be handled in near future.

All the (default & per-node) pwqs are mandatorily controlled by the low level cpumask. If the user configured cpumask doesn't overlap with the low level cpumask, the low level cpumask will be used for the wq instead.

The comment of wq_calc_node_cpumask() is updated and explicitly requires that its first argument should be the attrs of the default pwq.

The default wq_unbound_cpumask is cpu_possible_mask. The workqueue subsystem doesn't know its best default value, let the system manager or the other subsystem set it when needed.

Changed from V8:
merge the calculating code for the attrs of the default pwq together. minor change the code&comments for saving the user configured attrs. remove unnecessary list_del().
minor update the comment of wq_calc_node_cpumask().
update the comment of workqueue_set_unbound_cpumask();

Cc Christoph Lameter <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Lai Jiangshan <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 include/linux/workqueue.h |   1 +
 kernel/workqueue.c        | 127 ++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 119 insertions(+), 9 deletions(-)
include/linux/workqueue.h +1 -0
index deee212..4618dd6 100644
@@ -424,6 +424,7 @@ struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask);
 void free_workqueue_attrs(struct workqueue_attrs *attrs);
 int apply_workqueue_attrs(struct workqueue_struct *wq,
 			  const struct workqueue_attrs *attrs);
+int workqueue_set_unbound_cpumask(cpumask_var_t cpumask);
 
 extern bool queue_work_on(int cpu, struct workqueue_struct *wq,
 			struct work_struct *work);
kernel/workqueue.c +118 -9

192 lines not on this page · raw message

Signature · 1 line
2.1.0
maintainer Applied
#1 lore raw
Quoted 29 lines · Lai Jiangshan

Allow to modify the low-level unbound workqueues cpumask through sysfs. This is performed by traversing the entire workqueue list and calling apply_wqattrs_prepare() on the unbound workqueues with the new low level mask. Only after all the preparation are done, we commit them all together.

Ordered workqueues are ignored from the low level unbound workqueue cpumask, it will be handled in near future.

All the (default & per-node) pwqs are mandatorily controlled by the low level cpumask. If the user configured cpumask doesn't overlap with the low level cpumask, the low level cpumask will be used for the wq instead.

The comment of wq_calc_node_cpumask() is updated and explicitly requires that its first argument should be the attrs of the default pwq.

The default wq_unbound_cpumask is cpu_possible_mask. The workqueue subsystem doesn't know its best default value, let the system manager or the other subsystem set it when needed.

Changed from V8:
merge the calculating code for the attrs of the default pwq together. minor change the code&comments for saving the user configured attrs. remove unnecessary list_del().
minor update the comment of wq_calc_node_cpumask().
update the comment of workqueue_set_unbound_cpumask();

Quoted 10 lines
Cc Christoph Lameter <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Lai Jiangshan <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Frederic Weisbecker <[email protected]>

Applied to wq/for-4.2 and yeah the prepare function looks better now.

Thanks a lot for the persistence.

Signature · 1 line
tejun