diff options
author | Namhyung Kim <namhyung@kernel.org> | 2024-02-06 21:05:45 -0800 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2024-04-10 06:13:57 +0200 |
commit | f38628b06c36222367e26820879789ae59e49f60 (patch) | |
tree | 3a2cea20a240a80f2d5bbf7df451221d05241a1f /tools/perf/scripts/python/stackcollapse.py | |
parent | 0259bf63f71e2accfeca4a4e346ede8edcc86aab (diff) |
perf/core: Reduce PMU access to adjust sample freq
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
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions