History

cpuset: Propagate cpuset isolation update to workqueue through housekeeping

Until now, cpuset would propagate isolated partition changes to workqueues so that unbound workers get properly reaffined. Since housekeeping now centralizes, synchronize and propagates isolation cpumask changes, perform the work from that subsystem for consolidation and consistency purposes. For simplification purpose, the target function is adapted to take the new housekeeping mask instead of the isolated mask.

Frederic Weisbecker committed 1 year ago

Commit 23f09dc1 parent 29b306c5 files · +16 −12Browse files

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

Unified · Split

kernel/workqueue.c+10−7
@@ -6959,13 +6959,16 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) · 6958 unmodified lines
69596959 }
69606960
69616961 /**
6962− * workqueue_unbound_exclude_cpumask - Exclude given CPUs from unbound cpumask
6963− * @exclude_cpumask: the cpumask to be excluded from wq_unbound_cpumask
6962+ * workqueue_unbound_housekeeping_update - Propagate housekeeping cpumask update
6963+ * @hk: the new housekeeping cpumask
69646964 *
6965− * This function can be called from cpuset code to provide a set of isolated
6966− * CPUs that should be excluded from wq_unbound_cpumask.
6965+ * Update the unbound workqueue cpumask on top of the new housekeeping cpumask such
6966+ * that the effective unbound affinity is the intersection of the new housekeeping
6967+ * with the requested affinity set via nohz_full=/isolcpus= or sysfs.
6968+ *
6969+ * Return: 0 on success and -errno on failure.
69676970 */
6968−int workqueue_unbound_exclude_cpumask(cpumask_var_t exclude_cpumask)
6971+int workqueue_unbound_housekeeping_update(const struct cpumask *hk)
69696972 {
69706973 cpumask_var_t cpumask;
69716974 int ret = 0;
@@ -6981,14 +6984,14 @@ int workqueue_unbound_exclude_cpumask(cpumask_var_t exclude_cpumask) · 9 unmodified lines
69816984 * (HK_TYPE_WQ ∩ HK_TYPE_DOMAIN) house keeping mask and rewritten
69826985 * by any subsequent write to workqueue/cpumask sysfs file.
69836986 */
6984− if (!cpumask_andnot(cpumask, wq_requested_unbound_cpumask, exclude_cpumask))
6987+ if (!cpumask_and(cpumask, wq_requested_unbound_cpumask, hk))
69856988 cpumask_copy(cpumask, wq_requested_unbound_cpumask);
69866989 if (!cpumask_equal(cpumask, wq_unbound_cpumask))
69876990 ret = workqueue_apply_unbound_cpumask(cpumask);
69886991
69896992 /* Save the current isolated cpumask & export it via sysfs */
69906993 if (!ret)
6991− cpumask_copy(wq_isolated_cpumask, exclude_cpumask);
6994+ cpumask_andnot(wq_isolated_cpumask, cpu_possible_mask, hk);
69926995
69936996 mutex_unlock(&wq_pool_mutex);
69946997 free_cpumask_var(cpumask);