Message ID | 20231115170359.163299-2-longman@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | cgroup/cpuset: Improve CPU isolation in isolated partitions | expand |
Hi Waiman, kernel test robot noticed the following build warnings: [auto build test WARNING on shuah-kselftest/next] [also build test WARNING on shuah-kselftest/fixes linus/master v6.7-rc1] [cannot apply to tj-cgroup/for-next tj-wq/for-next next-20231115] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Waiman-Long/workqueue-Make-workqueue_set_unbound_cpumask-static/20231116-010940 base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next patch link: https://lore.kernel.org/r/20231115170359.163299-2-longman%40redhat.com patch subject: [PATCH v3 1/5] workqueue: Make workqueue_set_unbound_cpumask() static config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20231116/202311160353.FAdfQwO3-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231116/202311160353.FAdfQwO3-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311160353.FAdfQwO3-lkp@intel.com/ All warnings (new ones prefixed by >>): >> kernel/workqueue.c:4421:13: warning: 'apply_wqattrs_unlock' defined but not used [-Wunused-function] 4421 | static void apply_wqattrs_unlock(void) | ^~~~~~~~~~~~~~~~~~~~ >> kernel/workqueue.c:4414:13: warning: 'apply_wqattrs_lock' defined but not used [-Wunused-function] 4414 | static void apply_wqattrs_lock(void) | ^~~~~~~~~~~~~~~~~~ vim +/apply_wqattrs_unlock +4421 kernel/workqueue.c 8864b4e59f7945 Tejun Heo 2013-03-12 4413 a0111cf6710bd1 Lai Jiangshan 2015-05-19 @4414 static void apply_wqattrs_lock(void) a0111cf6710bd1 Lai Jiangshan 2015-05-19 4415 { a0111cf6710bd1 Lai Jiangshan 2015-05-19 4416 /* CPUs should stay stable across pwq creations and installations */ ffd8bea81fbb5a Sebastian Andrzej Siewior 2021-08-03 4417 cpus_read_lock(); a0111cf6710bd1 Lai Jiangshan 2015-05-19 4418 mutex_lock(&wq_pool_mutex); a0111cf6710bd1 Lai Jiangshan 2015-05-19 4419 } a0111cf6710bd1 Lai Jiangshan 2015-05-19 4420 a0111cf6710bd1 Lai Jiangshan 2015-05-19 @4421 static void apply_wqattrs_unlock(void) a0111cf6710bd1 Lai Jiangshan 2015-05-19 4422 { a0111cf6710bd1 Lai Jiangshan 2015-05-19 4423 mutex_unlock(&wq_pool_mutex); ffd8bea81fbb5a Sebastian Andrzej Siewior 2021-08-03 4424 cpus_read_unlock(); a0111cf6710bd1 Lai Jiangshan 2015-05-19 4425 } a0111cf6710bd1 Lai Jiangshan 2015-05-19 4426
On 11/15/23 14:12, kernel test robot wrote: > Hi Waiman, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on shuah-kselftest/next] > [also build test WARNING on shuah-kselftest/fixes linus/master v6.7-rc1] > [cannot apply to tj-cgroup/for-next tj-wq/for-next next-20231115] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Waiman-Long/workqueue-Make-workqueue_set_unbound_cpumask-static/20231116-010940 > base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next > patch link: https://lore.kernel.org/r/20231115170359.163299-2-longman%40redhat.com > patch subject: [PATCH v3 1/5] workqueue: Make workqueue_set_unbound_cpumask() static > config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20231116/202311160353.FAdfQwO3-lkp@intel.com/config) > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231116/202311160353.FAdfQwO3-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202311160353.FAdfQwO3-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > >>> kernel/workqueue.c:4421:13: warning: 'apply_wqattrs_unlock' defined but not used [-Wunused-function] > 4421 | static void apply_wqattrs_unlock(void) > | ^~~~~~~~~~~~~~~~~~~~ >>> kernel/workqueue.c:4414:13: warning: 'apply_wqattrs_lock' defined but not used [-Wunused-function] > 4414 | static void apply_wqattrs_lock(void) > | ^~~~~~~~~~~~~~~~~~ > > > vim +/apply_wqattrs_unlock +4421 kernel/workqueue.c > > 8864b4e59f7945 Tejun Heo 2013-03-12 4413 > a0111cf6710bd1 Lai Jiangshan 2015-05-19 @4414 static void apply_wqattrs_lock(void) > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4415 { > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4416 /* CPUs should stay stable across pwq creations and installations */ > ffd8bea81fbb5a Sebastian Andrzej Siewior 2021-08-03 4417 cpus_read_lock(); > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4418 mutex_lock(&wq_pool_mutex); > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4419 } > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4420 > a0111cf6710bd1 Lai Jiangshan 2015-05-19 @4421 static void apply_wqattrs_unlock(void) > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4422 { > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4423 mutex_unlock(&wq_pool_mutex); > ffd8bea81fbb5a Sebastian Andrzej Siewior 2021-08-03 4424 cpus_read_unlock(); > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4425 } > a0111cf6710bd1 Lai Jiangshan 2015-05-19 4426 > OK, there are more functions that are CONFIG_SYSFS specific and need to be moved as well. Will post another version to fix that :-( Regards, Longman
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 24b1e5070f4d..cf49b467bd57 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -491,7 +491,6 @@ struct workqueue_attrs *alloc_workqueue_attrs(void); void free_workqueue_attrs(struct workqueue_attrs *attrs); int apply_workqueue_attrs(struct workqueue_struct *wq, const struct workqueue_attrs *attrs); -int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); extern bool queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work); diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 6e578f576a6f..8996cdba8f07 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5784,7 +5784,7 @@ void thaw_workqueues(void) } #endif /* CONFIG_FREEZER */ -static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) +static int __maybe_unused workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) { LIST_HEAD(ctxs); int ret = 0; @@ -5827,43 +5827,6 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) return ret; } -/** - * workqueue_set_unbound_cpumask - Set the low-level unbound cpumask - * @cpumask: the cpumask to set - * - * The low-level workqueues cpumask is a global cpumask that limits - * the affinity of all unbound workqueues. This function check the @cpumask - * and apply it to all unbound workqueues and updates all pwqs of them. - * - * Return: 0 - Success - * -EINVAL - Invalid @cpumask - * -ENOMEM - Failed to allocate memory for attrs or pwqs. - */ -int workqueue_set_unbound_cpumask(cpumask_var_t cpumask) -{ - int ret = -EINVAL; - - /* - * Not excluding isolated cpus on purpose. - * If the user wishes to include them, we allow that. - */ - cpumask_and(cpumask, cpumask, cpu_possible_mask); - if (!cpumask_empty(cpumask)) { - apply_wqattrs_lock(); - if (cpumask_equal(cpumask, wq_unbound_cpumask)) { - ret = 0; - goto out_unlock; - } - - ret = workqueue_apply_unbound_cpumask(cpumask); - -out_unlock: - apply_wqattrs_unlock(); - } - - return ret; -} - static int parse_affn_scope(const char *val) { int i; @@ -6158,6 +6121,43 @@ static struct bus_type wq_subsys = { .dev_groups = wq_sysfs_groups, }; +/** + * workqueue_set_unbound_cpumask - Set the low-level unbound cpumask + * @cpumask: the cpumask to set + * + * The low-level workqueues cpumask is a global cpumask that limits + * the affinity of all unbound workqueues. This function check the @cpumask + * and apply it to all unbound workqueues and updates all pwqs of them. + * + * Return: 0 - Success + * -EINVAL - Invalid @cpumask + * -ENOMEM - Failed to allocate memory for attrs or pwqs. + */ +static int workqueue_set_unbound_cpumask(cpumask_var_t cpumask) +{ + int ret = -EINVAL; + + /* + * Not excluding isolated cpus on purpose. + * If the user wishes to include them, we allow that. + */ + cpumask_and(cpumask, cpumask, cpu_possible_mask); + if (!cpumask_empty(cpumask)) { + apply_wqattrs_lock(); + if (cpumask_equal(cpumask, wq_unbound_cpumask)) { + ret = 0; + goto out_unlock; + } + + ret = workqueue_apply_unbound_cpumask(cpumask); + +out_unlock: + apply_wqattrs_unlock(); + } + + return ret; +} + static ssize_t wq_unbound_cpumask_show(struct device *dev, struct device_attribute *attr, char *buf) {
The workqueue_set_unbound_cpumask() function is only used inside workqueue.c with CONFIG_SYSFS. Make it static and move it down to within the ifdef CONFIG_SYSFS block. Also mark workqueue_apply_unbound_cpumask() as __maybe_unused for now as it will be used by another function introduced in a later commit. There is no functional change. Signed-off-by: Waiman Long <longman@redhat.com> --- include/linux/workqueue.h | 1 - kernel/workqueue.c | 76 +++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 39 deletions(-)