Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Waiman Long <longman@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: "Michal Koutný" <mkoutny@suse.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Marco Crivellari <marco.crivellari@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Waiman Long <longman@redhat.com>
Cc: cgroups@vger.kernel.org

+16 -12
+1 -1
include/linux/workqueue.h
··· 588 588 void free_workqueue_attrs(struct workqueue_attrs *attrs); 589 589 int apply_workqueue_attrs(struct workqueue_struct *wq, 590 590 const struct workqueue_attrs *attrs); 591 - extern int workqueue_unbound_exclude_cpumask(cpumask_var_t cpumask); 591 + extern int workqueue_unbound_housekeeping_update(const struct cpumask *hk); 592 592 593 593 extern bool queue_work_on(int cpu, struct workqueue_struct *wq, 594 594 struct work_struct *work);
+1
init/Kconfig
··· 1254 1254 bool "Cpuset controller" 1255 1255 depends on SMP 1256 1256 select UNION_FIND 1257 + select CPU_ISOLATION 1257 1258 help 1258 1259 This option will let you create and manage CPUSETs which 1259 1260 allow dynamically partitioning a system into sets of CPUs and
+1 -4
kernel/cgroup/cpuset.c
··· 1482 1482 if (!isolated_cpus_updating) 1483 1483 return; 1484 1484 1485 - ret = workqueue_unbound_exclude_cpumask(isolated_cpus); 1485 + ret = housekeeping_update(isolated_cpus); 1486 1486 WARN_ON_ONCE(ret < 0); 1487 1487 1488 1488 ret = tmigr_isolated_exclude_cpumask(isolated_cpus); 1489 - WARN_ON_ONCE(ret < 0); 1490 - 1491 - ret = housekeeping_update(isolated_cpus); 1492 1489 WARN_ON_ONCE(ret < 0); 1493 1490 1494 1491 isolated_cpus_updating = false;
+3
kernel/sched/isolation.c
··· 121 121 int housekeeping_update(struct cpumask *isol_mask) 122 122 { 123 123 struct cpumask *trial, *old = NULL; 124 + int err; 124 125 125 126 lockdep_assert_cpus_held(); 126 127 ··· 149 148 pci_probe_flush_workqueue(); 150 149 mem_cgroup_flush_workqueue(); 151 150 vmstat_flush_workqueue(); 151 + err = workqueue_unbound_housekeeping_update(housekeeping_cpumask(HK_TYPE_DOMAIN)); 152 + WARN_ON_ONCE(err < 0); 152 153 153 154 kfree(old); 154 155
+10 -7
kernel/workqueue.c
··· 6959 6959 } 6960 6960 6961 6961 /** 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 6964 6964 * 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. 6967 6970 */ 6968 - int workqueue_unbound_exclude_cpumask(cpumask_var_t exclude_cpumask) 6971 + int workqueue_unbound_housekeeping_update(const struct cpumask *hk) 6969 6972 { 6970 6973 cpumask_var_t cpumask; 6971 6974 int ret = 0; ··· 6984 6981 * (HK_TYPE_WQ ∩ HK_TYPE_DOMAIN) house keeping mask and rewritten 6985 6982 * by any subsequent write to workqueue/cpumask sysfs file. 6986 6983 */ 6987 - if (!cpumask_andnot(cpumask, wq_requested_unbound_cpumask, exclude_cpumask)) 6984 + if (!cpumask_and(cpumask, wq_requested_unbound_cpumask, hk)) 6988 6985 cpumask_copy(cpumask, wq_requested_unbound_cpumask); 6989 6986 if (!cpumask_equal(cpumask, wq_unbound_cpumask)) 6990 6987 ret = workqueue_apply_unbound_cpumask(cpumask); 6991 6988 6992 6989 /* Save the current isolated cpumask & export it via sysfs */ 6993 6990 if (!ret) 6994 - cpumask_copy(wq_isolated_cpumask, exclude_cpumask); 6991 + cpumask_andnot(wq_isolated_cpumask, cpu_possible_mask, hk); 6995 6992 6996 6993 mutex_unlock(&wq_pool_mutex); 6997 6994 free_cpumask_var(cpumask);