Re: [PATCH v3 33/57] perf: Simplify perf_adjust_freq_unthr_context()

From: Linus Torvalds
Date: Mon Jun 12 2023 - 12:28:00 EST


This seems to have the same pattern that I *think* it's entirely
broken, ie you are doing that

guard(perf_pmu_disable)(event->pmu);

inside a loop, and then you are randomly just removing the

perf_pmu_enable(event->pmu);

at the end of the loop, or when you do a "continue"./

That's not right.

The thing does not not go out of scope when the loop *iterates*.

It only goes out of scope when the loop *ends*.

Big difference as far as cleanup goes.

So you have not "simplified" the unlocking code, you've broken it. Now
it no longer locks and unlocks for each iteration, it tries to re-lock
every time.

Or have I mis-understood something completely?

Linus