Commit 5de7a03
committed
workqueue: Factor out clearing of workqueue-only attrs fields
workqueue_attrs can be used for both workqueues and worker_pools. However,
some fields, currently only ->ordered, only apply to workqueues and should
be cleared to the default / invalid values.
Currently, an unbound workqueue explicitly clears attrs->ordered in
get_unbound_pool() after copying the source workqueue attrs, while per-cpu
workqueues rely on the fact that zeroing on allocation gives us the desired
default value for pool->attrs->ordered.
This is fragile. Let's add wqattrs_clear_for_pool() which clears
attrs->ordered and is called from both init_worker_pool() and
get_unbound_pool(). This will ease adding more workqueue-only attrs fields.
In get_unbound_pool(), pool->node initialization is moved upwards for
readability. This shouldn't cause any behavior changes.
Signed-off-by: Tejun Heo <tj@kernel.org>1 parent 0f36ee2 commit 5de7a03
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3678 | 3678 | | |
3679 | 3679 | | |
3680 | 3680 | | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
3681 | 3690 | | |
3682 | 3691 | | |
3683 | 3692 | | |
| |||
3752 | 3761 | | |
3753 | 3762 | | |
3754 | 3763 | | |
| 3764 | + | |
| 3765 | + | |
| 3766 | + | |
3755 | 3767 | | |
3756 | 3768 | | |
3757 | 3769 | | |
| |||
3942 | 3954 | | |
3943 | 3955 | | |
3944 | 3956 | | |
3945 | | - | |
3946 | 3957 | | |
3947 | 3958 | | |
3948 | | - | |
3949 | | - | |
3950 | | - | |
3951 | | - | |
3952 | | - | |
| 3959 | + | |
| 3960 | + | |
3953 | 3961 | | |
3954 | 3962 | | |
3955 | 3963 | | |
| |||
0 commit comments