lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <98aa5e37-258e-4efe-8e09-b8cfc5f78f0d@linux.ibm.com>
Date: Thu, 25 Sep 2025 01:56:02 +0530
From: Shrikanth Hegde <sshegde@...ux.ibm.com>
To: K Prateek Nayak <kprateek.nayak@....com>,
        Peter Zijlstra <peterz@...radead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>,
        Mel Gorman <mgorman@...e.de>, Valentin Schneider <vschneid@...hat.com>,
        "Gautham R. Shenoy" <gautham.shenoy@....com>,
        Swapnil Sapkal <swapnil.sapkal@....com>,
        Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Anna-Maria Behnsen <anna-maria@...utronix.de>,
        Frederic Weisbecker <frederic@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 01/19] sched/fair: Simplify set_cpu_sd_state_*() with
 guards



On 9/4/25 9:44 AM, K Prateek Nayak wrote:
> Simplify set_cpu_sd_state_{busy,idle}() using guard(rcu).
> 
> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@....com>
> Signed-off-by: K Prateek Nayak <kprateek.nayak@....com>
> ---
>   kernel/sched/fair.c | 20 ++++++++------------
>   1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index df8dc389af8e..61b59fd75ced 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12449,16 +12449,14 @@ static void set_cpu_sd_state_busy(int cpu)
>   {
>   	struct sched_domain *sd;
>   
> -	rcu_read_lock();
> -	sd = rcu_dereference(per_cpu(sd_llc, cpu));
> +	guard(rcu)();
>   
> +	sd = rcu_dereference(per_cpu(sd_llc, cpu));
>   	if (!sd || !sd->nohz_idle)
> -		goto unlock;
> -	sd->nohz_idle = 0;
> +		return;
>   
> +	sd->nohz_idle = 0;
>   	atomic_inc(&sd->shared->nr_busy_cpus);
> -unlock:
> -	rcu_read_unlock();
>   }
>   
>   void nohz_balance_exit_idle(struct rq *rq)
> @@ -12479,16 +12477,14 @@ static void set_cpu_sd_state_idle(int cpu)
>   {
>   	struct sched_domain *sd;
>   
> -	rcu_read_lock();
> -	sd = rcu_dereference(per_cpu(sd_llc, cpu));
> +	guard(rcu)();
>   
> +	sd = rcu_dereference(per_cpu(sd_llc, cpu));
>   	if (!sd || sd->nohz_idle)
> -		goto unlock;
> -	sd->nohz_idle = 1;
> +		return;
>   
> +	sd->nohz_idle = 1;
>   	atomic_dec(&sd->shared->nr_busy_cpus);
> -unlock:
> -	rcu_read_unlock();
>   }
>   
>   /*

This looks good.
Reviewed-by: Shrikanth Hegde <sshegde@...ux.ibm.com>

---

we have both sd_llc->shared and sd_llc_shared usage spread
across the code, is it possible to remove sd_llc_shared and use sd_llc->shared
instead?

Likely sd_llc is cache hot and access to shared should be fast too.
In turn this could free up some per cpu area.

Any thoughts?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ