[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFyQWLpI8B8B1AoM@yury>
Date: Wed, 25 Jun 2025 20:12:08 -0400
From: Yury Norov <yury.norov@...il.com>
To: Shrikanth Hegde <sshegde@...ux.ibm.com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, tglx@...utronix.de, maddy@...ux.ibm.com,
vschneid@...hat.com, dietmar.eggemann@....com, rostedt@...dmis.org,
kprateek.nayak@....com, huschle@...ux.ibm.com, srikar@...ux.ibm.com,
linux-kernel@...r.kernel.org, christophe.leroy@...roup.eu,
linuxppc-dev@...ts.ozlabs.org, gregkh@...uxfoundation.org
Subject: Re: [RFC v2 7/9] sched: Add static key check for cpu_avoid
On Thu, Jun 26, 2025 at 12:41:06AM +0530, Shrikanth Hegde wrote:
> Checking if a CPU is avoid can add a slight overhead and should be
> done only when necessary.
>
> Add a static key check which makes it almost nop when key is false.
> Arch needs to set the key when it decides to. Refer to debug patch
> for example.
>
> Signed-off-by: Shrikanth Hegde <sshegde@...ux.ibm.com>
> ---
> This method avoids additional ifdefs. So kept it that way instead of
> CONFIG_PARAVIRT.
>
> Added a helper function for cpu_avoid, since including sched.h fails in
> cpumask.h
>
> kernel/sched/core.c | 8 ++++----
> kernel/sched/fair.c | 5 +++--
> kernel/sched/rt.c | 8 ++++----
> kernel/sched/sched.h | 9 +++++++++
> 4 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index aea4232e3ec4..51426b17ef55 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -148,9 +148,9 @@ __read_mostly int sysctl_resched_latency_warn_once = 1;
> * Limited because this is done with IRQs disabled.
> */
> __read_mostly unsigned int sysctl_sched_nr_migrate = SCHED_NR_MIGRATE_BREAK;
> -
> __read_mostly int scheduler_running;
>
> +DEFINE_STATIC_KEY_FALSE(paravirt_cpu_avoid_enabled);
> #ifdef CONFIG_SCHED_CORE
>
> DEFINE_STATIC_KEY_FALSE(__sched_core_enabled);
> @@ -2438,7 +2438,7 @@ static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
> return false;
>
> /* CPU marked as avoid, shouldn't chosen to run any task*/
> - if (cpu_avoid(cpu))
> + if (cpu_avoid_check(cpu))
> return false;
Here you're patching the code that you've just added. Can you simply
add it in a proper way?..
Powered by blists - more mailing lists