[PATCH v1 1/6] perf pmu: Directly use evsel's PMU pointer

Adrian Hunter adrian.hunter at intel.com
Mon Jul 22 03:40:56 PDT 2024


On 21/07/24 23:21, Leo Yan wrote:
> Rather than iterating the whole PMU list for finding the associated PMU
> device for an evsel, this commit optimizes to directly use evsel's 'pmu'
> pointer for accessing PMU device.
> 
> Signed-off-by: Leo Yan <leo.yan at arm.com>
> ---
>  tools/perf/util/pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 986166bc7c78..798cd5a2ebc4 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -1199,7 +1199,7 @@ void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu)
>  
>  bool evsel__is_aux_event(const struct evsel *evsel)
>  {
> -	struct perf_pmu *pmu = evsel__find_pmu(evsel);
> +	struct perf_pmu *pmu = evsel->pmu;

Assumes event parser has populated evsel->pmu for auxtrace events.
Could use a comment to that effect.

>  
>  	return pmu && pmu->auxtrace;
>  }




More information about the linux-arm-kernel mailing list