[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<OSZPR01MB8798F324AB66D9B62495E9088B8AA@OSZPR01MB8798.jpnprd01.prod.outlook.com>
Date: Fri, 9 May 2025 08:39:51 +0000
From: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@...itsu.com>
To: 'James Morse' <james.morse@....com>, "x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Reinette Chatre <reinette.chatre@...el.com>, Thomas Gleixner
<tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov
<bp@...en8.de>, H Peter Anvin <hpa@...or.com>, Babu Moger
<Babu.Moger@....com>, "shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>, D Scott Phillips OS
<scott@...amperecomputing.com>, "carl@...amperecomputing.com"
<carl@...amperecomputing.com>, "lcherian@...vell.com" <lcherian@...vell.com>,
"bobo.shaobowang@...wei.com" <bobo.shaobowang@...wei.com>,
"baolin.wang@...ux.alibaba.com" <baolin.wang@...ux.alibaba.com>, Jamie Iles
<quic_jiles@...cinc.com>, Xin Hao <xhao@...ux.alibaba.com>,
"peternewman@...gle.com" <peternewman@...gle.com>, "dfustini@...libre.com"
<dfustini@...libre.com>, "amitsinght@...vell.com" <amitsinght@...vell.com>,
David Hildenbrand <david@...hat.com>, Rex Nie <rex.nie@...uarmicro.com>, Dave
Martin <dave.martin@....com>, Koba Ko <kobak@...dia.com>, Shanker Donthineni
<sdonthineni@...dia.com>, "fenghuay@...dia.com" <fenghuay@...dia.com>, "Yury
Norov [NVIDIA]" <yury.norov@...il.com>
Subject: RE: [PATCH v10 04/30] x86/resctrl: Optimize
cpumask_any_housekeeping()
Hello James,
> From: "Yury Norov [NVIDIA]" <yury.norov@...il.com>
>
> With the lack of cpumask_any_andnot_but(), cpumask_any_housekeeping()
> has to abuse cpumask_nth() functions.
>
> Update cpumask_any_housekeeping() to use the new cpumask_any_but()
> and cpumask_any_andnot_but(). These two functions understand
> RESCTRL_PICK_ANY_CPU, which simplifies cpumask_any_housekeeping()
> significantly.
>
> Tested-by: James Morse <james.morse@....com>
> Reviewed-by: James Morse <james.morse@....com>
> Reviewed-by: Reinette Chatre <reinette.chatre@...el.com>
> Signed-off-by: Yury Norov [NVIDIA] <yury.norov@...il.com>
> Signed-off-by: James Morse <james.morse@....com>
> ---
> arch/x86/kernel/cpu/resctrl/internal.h | 28 +++++++-------------------
> 1 file changed, 7 insertions(+), 21 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h
> b/arch/x86/kernel/cpu/resctrl/internal.h
> index eaae99602b61..25b61e466715 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -47,30 +47,16 @@
> static inline unsigned int
> cpumask_any_housekeeping(const struct cpumask *mask, int exclude_cpu)
> {
> - unsigned int cpu, hk_cpu;
> -
> - if (exclude_cpu == RESCTRL_PICK_ANY_CPU)
> - cpu = cpumask_any(mask);
> - else
> - cpu = cpumask_any_but(mask, exclude_cpu);
> -
> - /* Only continue if tick_nohz_full_mask has been initialized. */
> - if (!tick_nohz_full_enabled())
> - return cpu;
> -
> - /* If the CPU picked isn't marked nohz_full nothing more needs doing.
> */
> - if (cpu < nr_cpu_ids && !tick_nohz_full_cpu(cpu))
> - return cpu;
> + unsigned int cpu;
>
> /* Try to find a CPU that isn't nohz_full to use in preference */
> - hk_cpu = cpumask_nth_andnot(0, mask, tick_nohz_full_mask);
> - if (hk_cpu == exclude_cpu)
> - hk_cpu = cpumask_nth_andnot(1, mask,
> tick_nohz_full_mask);
It seems that the cpumask_nth_andnot() function is no longer used anywhere,
so it's better to remove it from ./include/linux/cpumask.h.
Best regards,
Shaopeng TAN
> + if (tick_nohz_full_enabled()) {
> + cpu = cpumask_any_andnot_but(mask, tick_nohz_full_mask,
> exclude_cpu);
> + if (cpu < nr_cpu_ids)
> + return cpu;
> + }
>
> - if (hk_cpu < nr_cpu_ids)
> - cpu = hk_cpu;
> -
> - return cpu;
> + return cpumask_any_but(mask, exclude_cpu);
> }
>
> struct rdt_fs_context {
> --
> 2.39.5
Powered by blists - more mailing lists