[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgaSkM4fjdP9dcdXQpLLjxW43ykgLA=FgzyHpyHayz8ww@mail.gmail.com>
Date: Mon, 12 Jun 2023 11:55:57 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: keescook@...omium.org, gregkh@...uxfoundation.org,
pbonzini@...hat.com, masahiroy@...nel.org, nathan@...nel.org,
ndesaulniers@...gle.com, nicolas@...sle.eu,
catalin.marinas@....com, will@...nel.org, vkoul@...nel.org,
trix@...hat.com, ojeda@...nel.org, mingo@...hat.com,
longman@...hat.com, boqun.feng@...il.com, dennis@...nel.org,
tj@...nel.org, cl@...ux.com, acme@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
namhyung@...nel.org, irogers@...gle.com, adrian.hunter@...el.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
paulmck@...nel.org, frederic@...nel.org, quic_neeraju@...cinc.com,
joel@...lfernandes.org, josh@...htriplett.org,
mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
rientjes@...gle.com, vbabka@...e.cz, roman.gushchin@...ux.dev,
42.hyeyoo@...il.com, apw@...onical.com, joe@...ches.com,
dwaipayanray1@...il.com, lukas.bulwahn@...il.com,
john.johansen@...onical.com, paul@...l-moore.com,
jmorris@...ei.org, serge@...lyn.com, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, dmaengine@...r.kernel.org,
llvm@...ts.linux.dev, linux-perf-users@...r.kernel.org,
rcu@...r.kernel.org, linux-security-module@...r.kernel.org,
tglx@...utronix.de, ravi.bangoria@....com, error27@...il.com,
luc.vanoostenryck@...il.com
Subject: Re: [PATCH v3 33/57] perf: Simplify perf_adjust_freq_unthr_context()
On Mon, Jun 12, 2023 at 11:44 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> I tried this before I used it and variables inside a for() loop have a
> scope of a single iteration.
Whee. Ok, that surprised me. But I guess that I shouldn't have found
it surprising, since the value doesn't survive from one iteration to
the next.
My mental picture of the scope was just different - and apparently wrong.
But thinking about it, it's not just that the value doesn't survive,
it's also that the "continue" will exit the scope in order to go back
to the "for()" loop.
I guess the "goto repeat" ends up being similar, since - as Ian Lance
Taylor said in one of the earlier discussions - that "__cleanup__"
ends up creating an implicit hidden scope for the variable. So a
'goto' to before the variable was declared implicitly exits the scope.
Ugh. I do really hate how subtle that is, though.
So while it might not be the horrible bug I thought it was, I'd
_really_ like us to not do those things just from a sanity angle.
Linus
Powered by blists - more mailing lists