linux-stable/tools/perf
Arnaldo Carvalho de Melo f350ee9549 perf evlist: No need to setup affinities when enabling events for pid targets
When the target is a pid, not started by 'perf stat' we need to enable
the events, and in that case there is no need to setup affinities as we
use a dummy CPU map, with just one entry set to -1.

So stop doing it to avoid this needless call to sched_getaffinity():

  # strace -ke sched_getaffinity perf stat -e cycles -p 241957 sleep 1
  <SNIP>
  sched_getaffinity(0, 512, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]) = 8
   > /usr/lib64/libc-2.33.so(sched_getaffinity@@GLIBC_2.3.4+0x1a) [0xe6eea]
   > /var/home/acme/bin/perf(affinity__setup+0x6a) [0x5329ca]
   > /var/home/acme/bin/perf(__evlist__enable.constprop.0+0x23) [0x4b9693]
   > /var/home/acme/bin/perf(enable_counters+0x14d) [0x42de5d]
   > /var/home/acme/bin/perf(cmd_stat+0x2358) [0x4310c8]
   > /var/home/acme/bin/perf(run_builtin+0x6a) [0x4a2cfa]
   > /var/home/acme/bin/perf(main+0x612) [0x40f8c2]
   > /usr/lib64/libc-2.33.so(__libc_start_main+0xd4) [0x27b74]
   > /var/home/acme/bin/perf(_start+0x2d) [0x40fadd]
  <SNIP>

Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20220117160931.1191712-4-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-01-18 09:24:58 -03:00
..
arch perf cpumap: Give CPUs their own type 2022-01-12 14:28:23 -03:00
bench perf cpumap: Give CPUs their own type 2022-01-12 14:28:23 -03:00
dlfilters perf dlfilter: Drop unused variable 2021-12-16 12:18:11 -03:00
Documentation perf record: Disable debuginfod by default 2022-01-15 17:41:25 -03:00
examples/bpf
include
jvmti
pmu-events perf pmu-events: Don't lower case MetricExpr 2022-01-12 15:02:48 -03:00
python
scripts perf scripts python: intel-pt-events.py: Fix printing of switch events 2021-12-28 17:26:25 -03:00
tests Merge remote-tracking branch 'torvalds/master' into perf/core 2022-01-13 10:20:59 -03:00
trace perf beauty: Add socket level scnprintf that handles ARCH specific SOL_SOCKET 2021-11-12 10:40:34 -03:00
ui perf annotate: Avoid TUI crash when navigating in the annotation of recursive functions 2022-01-10 15:47:30 -03:00
util perf evlist: No need to setup affinities when enabling events for pid targets 2022-01-18 09:24:58 -03:00
.gitignore Add 'tools/perf/libbpf/' to ignored files 2021-11-08 11:33:35 -08:00
Build
builtin-annotate.c perf tools: Check vmlinux/kallsyms arguments in all tools 2021-11-07 12:27:38 -03:00
builtin-bench.c perf bench: Use unbuffered output when pipe/tee'ing to a file 2021-12-16 12:18:11 -03:00
builtin-buildid-cache.c perf record: Disable debuginfod by default 2022-01-15 17:41:25 -03:00
builtin-buildid-list.c
builtin-c2c.c perf cpumap: Give CPUs their own type 2022-01-12 14:28:23 -03:00
builtin-config.c
builtin-daemon.c perf daemon: Remove duplicate sys/file.h include 2021-10-08 15:14:50 -03:00
builtin-data.c
builtin-diff.c
builtin-evlist.c
builtin-ftrace.c perf cpumap: Give CPUs their own type 2022-01-12 14:28:23 -03:00
builtin-help.c
builtin-inject.c perf inject: Fix segfault due to perf_data__fd() without open 2021-12-18 08:31:14 -03:00
builtin-kallsyms.c
builtin-kmem.c perf cpumap: Give CPUs their own type 2022-01-12 14:28:23 -03:00
builtin-kvm.c
builtin-list.c perf list: Display hybrid PMU events with cpu type 2021-10-25 13:47:42 -03:00
builtin-lock.c
builtin-mem.c
builtin-probe.c perf tools: Check vmlinux/kallsyms arguments in all tools 2021-11-07 12:27:38 -03:00
builtin-record.c perf record: Disable debuginfod by default 2022-01-15 17:41:25 -03:00
builtin-report.c perf callchain: Enable dwarf_callchain_users on arm64 2021-12-21 18:35:44 -03:00
builtin-sched.c perf cpumap: Give CPUs their own type 2022-01-12 14:28:23 -03:00
builtin-script.c perf cpumap: Give CPUs their own type 2022-01-12 14:28:23 -03:00
builtin-stat.c perf stat: No need to setup affinities when starting a workload 2022-01-18 09:24:58 -03:00
builtin-timechart.c
builtin-top.c perf tools: Check vmlinux/kallsyms arguments in all tools 2021-11-07 12:27:38 -03:00
builtin-trace.c perf tools changes for v5.17: 1st batch 2022-01-18 06:32:11 +02:00
builtin-version.c
builtin.h
check-headers.sh tools lib: Adopt list_sort() from the kernel sources 2021-10-20 10:30:59 -03:00
command-list.txt
CREDITS
design.txt perf design.txt: Synchronize the definition of enum perf_hw_id with code 2021-11-13 18:11:50 -03:00
Makefile
Makefile.config perf tools: Drop requirement for libstdc++.so for libopencsd check 2021-12-07 22:18:24 -03:00
Makefile.perf perf ftrace: Add -b/--use-bpf option for latency subcommand 2021-12-16 12:18:12 -03:00
MANIFEST perf MANIFEST: Add bpftool files to allow building with BUILD_BPF_SKEL=1 2021-11-07 15:39:28 -03:00
perf-archive.sh
perf-completion.sh
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c
perf.h