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
6959}6959}
6960 6960
6961/**6961/**
6962 * workqueue_unbound_exclude_cpumask - Exclude given CPUs from unbound cpumask6962 * workqueue_unbound_housekeeping_update - Propagate housekeeping cpumask update
6963 * @exclude_cpumask: the cpumask to be excluded from wq_unbound_cpumask6963 * @hk: the new housekeeping cpumask
6964 *6964 *
6965 * This function can be called from cpuset code to provide a set of isolated6965 * Update the unbound workqueue cpumask on top of the new housekeeping cpumask such
6966 * CPUs that should be excluded from wq_unbound_cpumask.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.
6967 */6970 */
6968int workqueue_unbound_exclude_cpumask(cpumask_var_t exclude_cpumask)6971int workqueue_unbound_housekeeping_update(const struct cpumask *hk)
6969{6972{
6970 cpumask_var_t cpumask;6973 cpumask_var_t cpumask;
6971 int ret = 0;6974 int ret = 0;
@@ -6981,14 +6984,14 @@ int workqueue_unbound_exclude_cpumask(cpumask_var_t exclude_cpumask) · 9 unmodified lines
6981 * (HK_TYPE_WQ ∩ HK_TYPE_DOMAIN) house keeping mask and rewritten6984 * (HK_TYPE_WQ ∩ HK_TYPE_DOMAIN) house keeping mask and rewritten
6982 * by any subsequent write to workqueue/cpumask sysfs file.6985 * by any subsequent write to workqueue/cpumask sysfs file.
6983 */6986 */
6984 if (!cpumask_andnot(cpumask, wq_requested_unbound_cpumask, exclude_cpumask))6987 if (!cpumask_and(cpumask, wq_requested_unbound_cpumask, hk))
6985 cpumask_copy(cpumask, wq_requested_unbound_cpumask);6988 cpumask_copy(cpumask, wq_requested_unbound_cpumask);
6986 if (!cpumask_equal(cpumask, wq_unbound_cpumask))6989 if (!cpumask_equal(cpumask, wq_unbound_cpumask))
6987 ret = workqueue_apply_unbound_cpumask(cpumask);6990 ret = workqueue_apply_unbound_cpumask(cpumask);
6988 6991
6989 /* Save the current isolated cpumask & export it via sysfs */6992 /* Save the current isolated cpumask & export it via sysfs */
6990 if (!ret)6993 if (!ret)
6991 cpumask_copy(wq_isolated_cpumask, exclude_cpumask);6994 cpumask_andnot(wq_isolated_cpumask, cpu_possible_mask, hk);
6992 6995
6993 mutex_unlock(&wq_pool_mutex);6996 mutex_unlock(&wq_pool_mutex);
6994 free_cpumask_var(cpumask);6997 free_cpumask_var(cpumask);