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]
Date:   Thu, 10 Aug 2023 09:03:21 +0100
From:   Valentin Schneider <vschneid@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...hat.com, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        bristot@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/9] sched: Simplify ttwu()

On 09/08/23 21:26, Peter Zijlstra wrote:
> On Wed, Aug 09, 2023 at 04:21:36PM +0100, Valentin Schneider wrote:
>> On 01/08/23 22:41, Peter Zijlstra wrote:
>> > Use guards to reduce gotos and simplify control flow.
>> >
>> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
>> > ---
>> >  kernel/sched/core.c |  221 +++++++++++++++++++++++++---------------------------
>> >  1 file changed, 109 insertions(+), 112 deletions(-)
>> >
>> > --- a/kernel/sched/core.c
>> > +++ b/kernel/sched/core.c
>> > @@ -3706,14 +3706,14 @@ ttwu_stat(struct task_struct *p, int cpu
>> >               struct sched_domain *sd;
>> >
>> >               __schedstat_inc(p->stats.nr_wakeups_remote);
>> > -		rcu_read_lock();
>> > +
>> > +		guard(rcu)();
>>
>> This isn't strictly equivalent, right? AFAICT that pushes the
>> rcu_read_unlock() further down than it currently is - not a big deal, but
>> indentation aside scoped_guard() would preserve that.
>
> The full hunk:
>
> | @@ -3706,14 +3706,14 @@ ttwu_stat(struct task_struct *p, int cpu
> |             struct sched_domain *sd;
> |
> |             __schedstat_inc(p->stats.nr_wakeups_remote);
> | -		rcu_read_lock();
> | +
> | +		guard(rcu)();
> |             for_each_domain(rq->cpu, sd) {
> |                     if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
> |                             __schedstat_inc(sd->ttwu_wake_remote);
> |                             break;
> |                     }
> |             }
> | -		rcu_read_unlock();
> |     }
>
> And you'll see the guard goes out of scope here ^
>
> Which is the exact place rcu_read_unlock() was at, no?

Bleh, yes, lost track of the scope there...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ