Commit 16ee5e6
perf/core: Reduce PMU access to adjust sample freq
BugLink: https://bugs.launchpad.net/bugs/2106004
In perf_adjust_freq_unthr_context(), it first starts the event and then
stop unnecessarily to adjust the sampling frequency if the event is
throttled.
For a throttled non-frequency event, it doesn't have a freq so no need
to adjust. Just starting the event would be ok.
For a frequency event, whether it's throttled or not, it needs to stop
before adjusting the frequency. That means it should not start the
even if it was throttled. I tried to skip calling the stop callback,
but it didn't work well since the event count might not be up to date.
It should call the stop callback with PERF_EF_UPDATE anyway.
However not calling start would prevent unnecessary MSR accesses (which
can be costly) for already stopped events as stop state is saved in the
hw config.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Link: https://lore.kernel.org/r/20240207050545.2727923-2-namhyung@kernel.org
(cherry picked from commit f38628b)
Signed-off-by: Philip Cox <philip.cox@canonical.com>
Acked-by: Massimiliano Pellizzer <massimiliano.pellizzer@canonical.com>
Acked-by: Kuba Pawlak <kuba.pawlak@canonical.com>1 parent 89901df commit 16ee5e6
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4156 | 4156 | | |
4157 | 4157 | | |
4158 | 4158 | | |
4159 | | - | |
| 4159 | + | |
| 4160 | + | |
4160 | 4161 | | |
4161 | 4162 | | |
4162 | 4163 | | |
| |||
0 commit comments