History

Merge branch 'for-4.13-fixes' into for-4.14

Tejun Heo committed 9 years ago

Commit 058fc472 parents c5a94a6 1ad0f0a6 files · +36 −11Browse files

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

Unified · Split

kernel/workqueue.c+26−4
@@ -3577,6 +3577,13 @@ static bool wq_calc_node_cpumask(const struct workqueue_attrs *attrs, int node, · 3576 unmodified lines
35773577
35783578 /* yeap, return possible CPUs in @node that @attrs wants */
35793579 cpumask_and(cpumask, attrs->cpumask, wq_numa_possible_cpumask[node]);
3580+
3581+ if (cpumask_empty(cpumask)) {
3582+ pr_warn_once("WARNING: workqueue cpumask: online intersect > "
3583+ "possible intersect\n");
3584+ return false;
3585+ }
3586+
35803587 return !cpumask_equal(cpumask, attrs->cpumask);
35813588
35823589 use_dfl:
@@ -3744,8 +3751,12 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq, · 161 unmodified lines
37443751 return -EINVAL;
37453752
37463753 /* creating multiple pwqs breaks ordering guarantee */
3747− if (WARN_ON((wq->flags & __WQ_ORDERED) && !list_empty(&wq->pwqs)))
3748− return -EINVAL;
3754+ if (!list_empty(&wq->pwqs)) {
3755+ if (WARN_ON(wq->flags & __WQ_ORDERED_EXPLICIT))
3756+ return -EINVAL;
3757+
3758+ wq->flags &= ~__WQ_ORDERED;
3759+ }
37493760
37503761 ctx = apply_wqattrs_prepare(wq, attrs);
37513762 if (!ctx)
@@ -3929,6 +3940,16 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt, · 177 unmodified lines
39293940 struct workqueue_struct *wq;
39303941 struct pool_workqueue *pwq;
39313942
3943+ /*
3944+ * Unbound && max_active == 1 used to imply ordered, which is no
3945+ * longer the case on NUMA machines due to per-node pools. While
3946+ * alloc_ordered_workqueue() is the right way to create an ordered
3947+ * workqueue, keep the previous behavior to avoid subtle breakages
3948+ * on NUMA.
3949+ */
3950+ if ((flags & WQ_UNBOUND) && max_active == 1)
3951+ flags |= __WQ_ORDERED;
3952+
39323953 /* see the comment above the definition of WQ_POWER_EFFICIENT */
39333954 if ((flags & WQ_POWER_EFFICIENT) && wq_power_efficient)
39343955 flags |= WQ_UNBOUND;
@@ -4119,13 +4140,14 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active) · 184 unmodified lines
41194140 struct pool_workqueue *pwq;
41204141
41214142 /* disallow meddling with max_active for ordered workqueues */
4122− if (WARN_ON(wq->flags & __WQ_ORDERED))
4143+ if (WARN_ON(wq->flags & __WQ_ORDERED_EXPLICIT))
41234144 return;
41244145
41254146 max_active = wq_clamp_max_active(max_active, wq->flags, wq->name);
41264147
41274148 mutex_lock(&wq->mutex);
41284149
4150+ wq->flags &= ~__WQ_ORDERED;
41294151 wq->saved_max_active = max_active;
41304152
41314153 for_each_pwq(pwq, wq)
@@ -5253,7 +5275,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq) · 1121 unmodified lines
52535275 * attributes breaks ordering guarantee. Disallow exposing ordered
52545276 * workqueues.
52555277 */
5256− if (WARN_ON(wq->flags & __WQ_ORDERED))
5278+ if (WARN_ON(wq->flags & __WQ_ORDERED_EXPLICIT))
52575279 return -EINVAL;
52585280
52595281 wq->wq_dev = wq_dev = kzalloc(sizeof(*wq_dev), GFP_KERNEL);