Re: [PATCH v3] sched/isolation: add a workqueue parameter onto isolcpus to constrain unbound CPUs

From: Frederic Weisbecker
Date: Mon Jun 26 2023 - 18:59:12 EST


On Thu, Jun 22, 2023 at 11:22:17AM +0800, 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,
> i,e, some CPUs are busy with interrupts.
>
> Also remove HK_FLAG_WQ from nohz_full to prevent nohz_full overriding
> workqueue's cpu config.

But then nohz_full= doesn't re-affine workqueues anymore, right?

>
> Suggested-by: Tejun Heo <tj@xxxxxxxxxx>
> Signed-off-by: tiozhang <tiozhang@xxxxxxxxxxxxxx>
> ---
> kernel/sched/isolation.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> index 373d42c707bc..5cd67c51622e 100644
> --- a/kernel/sched/isolation.c
> +++ b/kernel/sched/isolation.c
> @@ -181,8 +181,8 @@ static int __init housekeeping_nohz_full_setup(char *str)
> {
> unsigned long flags;
>
> - flags = HK_FLAG_TICK | HK_FLAG_WQ | HK_FLAG_TIMER | HK_FLAG_RCU |
> - HK_FLAG_MISC | HK_FLAG_KTHREAD;
> + flags = HK_FLAG_TICK | HK_FLAG_TIMER | HK_FLAG_RCU | HK_FLAG_MISC
> + | HK_FLAG_KTHREAD;
>
> return housekeeping_setup(str, flags);
> }
> @@ -208,6 +208,12 @@ static int __init housekeeping_isolcpus_setup(char *str)
> continue;
> }
>
> + if (!strncmp(str, "workqueue,", 10)) {
> + str += 10;
> + flags |= HK_FLAG_WQ;
> + continue;
> + }
> +

I'm planning on removing HK_FLAG_TICK, HK_FLAG_WQ, HK_FLAG_TIMER, HK_FLAG_RCU,
HK_FLAG_MISC and HK_FLAG_KTHREAD and merge them all together. Also the problem with
these flags is that once they are modified on boot, you can't modify them later.

I much prefer what was done in this patch:

https://lore.kernel.org/all/20230623073033.GA6584@didi-ThinkCentre-M930t-N000/

Thanks!

> if (!strncmp(str, "managed_irq,", 12)) {
> str += 12;
> flags |= HK_FLAG_MANAGED_IRQ;
> --
> 2.17.1
>