Re: [PATCH v4] workqueue: add cmdline parameter `workqueue.unbound_cpus` to further constrain wq_unbound_cpumask at boot time

From: Randy Dunlap
Date: Wed Jun 28 2023 - 14:52:05 EST


Hi--

On 6/28/23 04:18, tiozhang wrote:
> Motivation of doing this is to better improve boot times for devices when
> we want to prevent our workqueue works from running on some specific CPUs,
> e,g, some CPUs are busy with interrupts.
>
> Signed-off-by: tiozhang <tiozhang@xxxxxxxxxxxxxx>
> ---
> .../admin-guide/kernel-parameters.txt | 7 +++++++
> kernel/workqueue.c | 20 +++++++++++++++++++
> 2 files changed, 27 insertions(+)
>

> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 7cd5f5e7e0a1..29e8254edd63 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c

> @@ -6129,3 +6135,17 @@ void __init workqueue_init(void)
> */
> void __warn_flushing_systemwide_wq(void) { }
> EXPORT_SYMBOL(__warn_flushing_systemwide_wq);
> +
> +static int __init workqueue_unbound_cpus_setup(char *str)
> +{
> + int ret;
> +
> + ret = cpulist_parse(str, &wq_cmdline_cpumask);
> + if (ret < 0) {
> + cpumask_clear(&wq_cmdline_cpumask);
> + pr_warn("workqueue.unbound_cpus: incorrect CPU range\n");
> + }
> +
> + return ret;
> +}
> +__setup("workqueue.unbound_cpus=", workqueue_unbound_cpus_setup);

__setup() functions don't return 0 for success or errno/other values
for error. They return 1 if the parameter is handled and 0 if it is
not handled, as documented in include/linux/init.h.

And "handled" basically means "recognized" as a kernel parameter,
not that the value(s) passed to it are correct.
I.e., they should usually return 0.

--
~Randy