[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7cieEnuVZ7S0Yab6c3N=qKqgNSP3DL2JNFje1HFA7dcTtA@mail.gmail.com>
Date: Mon, 2 Oct 2023 21:10:43 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Leo Yan <leo.yan@...aro.org>,
Ravi Bangoria <ravi.bangoria@....com>,
James Clark <james.clark@....com>,
Kan Liang <kan.liang@...ux.intel.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] perf pmus: Make PMU alias name loading lazy
On Wed, Sep 27, 2023 at 10:19 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Wed, Sep 27, 2023 at 10:00 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > Hi Ian,
> >
> > On Sun, Sep 24, 2023 at 11:24 PM Ian Rogers <irogers@...gle.com> wrote:
> > >
> > > PMU alias names were computed when the first perf_pmu is created,
> > > scanning all PMUs in event sources for a file called alias that
> > > generally doesn't exist. Switch to trying to load the file when all
> > > PMU related files are loaded in lookup. This would cause a PMU name
> > > lookup of an alias name to fail if no PMUs were loaded, so in that
> > > case all PMUs are loaded and the find repeated. The overhead is
> > > similar but in the (very) general case not all PMUs are scanned for
> > > the alias file.
> > >
> > > As the overhead occurs once per invocation it doesn't show in perf
> > > bench internals pmu-scan. On a tigerlake machine, the number of openat
> > > system calls for an event of cpu/cycles/ with perf stat reduces from
> > > 94 to 69 (ie 25 fewer openat calls).
> >
> > I think the pmu-scan bench could show the difference as it
> > calls perf_pmu__destroy() in the loop body. So every call to
> > perf_pmu__scan() should start from nothing, right?
>
> The PMU alias name list was funny. It is/was maintained in the x86
> specific PMU code and the destroy didn't clear the list. This change
> adds an openat to loading a PMU for the alias, so pmu-scan shows a
> very small slow down. However, in the more normal cases we're reducing
> the number of openats by 25%.
I think that's ok. Applied to perf-tools-next, thanks!
Powered by blists - more mailing lists