[PATCH v5 0/3] perf stat affinity changes

Ian Rogers posted 3 patches 2 months, 2 weeks ago
There is a newer version of this series
tools/perf/Documentation/perf-stat.txt |   4 +
tools/perf/builtin-stat.c              | 159 ++++++++++++++-----------
tools/perf/util/evlist.c               | 156 ++++++++++++++----------
tools/perf/util/evlist.h               |  27 +++--
tools/perf/util/pmu.c                  |  12 ++
tools/perf/util/pmu.h                  |   1 +
6 files changed, 222 insertions(+), 137 deletions(-)
[PATCH v5 0/3] perf stat affinity changes
Posted by Ian Rogers 2 months, 2 weeks ago
The remnants of:
https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/

Read tool events last so that counts shouldn't exceed theoretic
maximums.

Change how affinities work with evlist__for_each_cpu. Move the
affinity code into the iterator to simplify setting it up. Detect when
affinities will and won't be profitable, for example a tool event and
a regular perf event (or read group) may face less delay from a single
IPI for the event read than from a call to sched_setaffinity. Add a
 --no-affinity flag to perf stat to allow affinities to be disabled.

v5: Drop merged changes. Move tool event reading to first
    patch. Change --no-affinity flag to --affinity/--no-affinity flag.

v4: Rebase. Add patch to reduce scope of walltime_nsec_stats now that
    the legacy metric code is no more. Minor tweak to the ru_stats
    clean up.
https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/

v3: Add affinity clean ups and read tool events last.
https://lore.kernel.org/lkml/20251106071241.141234-1-irogers@google.com/

v2: Fixed an aggregation index issue:
https://lore.kernel.org/lkml/20251104234148.3103176-2-irogers@google.com/

v1:
https://lore.kernel.org/lkml/20251104053449.1208800-1-irogers@google.com/

Ian Rogers (3):
  perf stat: Read tool events last
  perf evlist: Reduce affinity use and move into iterator, fix no
    affinity
  perf stat: Add no-affinity flag

 tools/perf/Documentation/perf-stat.txt |   4 +
 tools/perf/builtin-stat.c              | 159 ++++++++++++++-----------
 tools/perf/util/evlist.c               | 156 ++++++++++++++----------
 tools/perf/util/evlist.h               |  27 +++--
 tools/perf/util/pmu.c                  |  12 ++
 tools/perf/util/pmu.h                  |   1 +
 6 files changed, 222 insertions(+), 137 deletions(-)

-- 
2.52.0.rc1.455.g30608eb744-goog
Re: [PATCH v5 0/3] perf stat affinity changes
Posted by Ian Rogers 1 month ago
On Tue, Nov 18, 2025 at 1:13 PM Ian Rogers <irogers@google.com> wrote:
>
> The remnants of:
> https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/
>
> Read tool events last so that counts shouldn't exceed theoretic
> maximums.
>
> Change how affinities work with evlist__for_each_cpu. Move the
> affinity code into the iterator to simplify setting it up. Detect when
> affinities will and won't be profitable, for example a tool event and
> a regular perf event (or read group) may face less delay from a single
> IPI for the event read than from a call to sched_setaffinity. Add a
>  --no-affinity flag to perf stat to allow affinities to be disabled.

Ping.

Thanks,
Ian

> v5: Drop merged changes. Move tool event reading to first
>     patch. Change --no-affinity flag to --affinity/--no-affinity flag.
>
> v4: Rebase. Add patch to reduce scope of walltime_nsec_stats now that
>     the legacy metric code is no more. Minor tweak to the ru_stats
>     clean up.
> https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/
>
> v3: Add affinity clean ups and read tool events last.
> https://lore.kernel.org/lkml/20251106071241.141234-1-irogers@google.com/
>
> v2: Fixed an aggregation index issue:
> https://lore.kernel.org/lkml/20251104234148.3103176-2-irogers@google.com/
>
> v1:
> https://lore.kernel.org/lkml/20251104053449.1208800-1-irogers@google.com/
>
> Ian Rogers (3):
>   perf stat: Read tool events last
>   perf evlist: Reduce affinity use and move into iterator, fix no
>     affinity
>   perf stat: Add no-affinity flag
>
>  tools/perf/Documentation/perf-stat.txt |   4 +
>  tools/perf/builtin-stat.c              | 159 ++++++++++++++-----------
>  tools/perf/util/evlist.c               | 156 ++++++++++++++----------
>  tools/perf/util/evlist.h               |  27 +++--
>  tools/perf/util/pmu.c                  |  12 ++
>  tools/perf/util/pmu.h                  |   1 +
>  6 files changed, 222 insertions(+), 137 deletions(-)
>
> --
> 2.52.0.rc1.455.g30608eb744-goog
>