diff options
author | Andi Kleen <ak@linux.intel.com> | 2019-11-21 01:15:12 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-11-28 12:08:38 +0100 |
commit | 267ed5d8593cedd6146eabe00d270629c9cff771 (patch) | |
tree | 782480a707963311c56467d4056f63bea7362ab8 /tools/perf/util/affinity.h | |
parent | perf pmu: Use file system cache to optimize sysfs access (diff) | |
download | linux-267ed5d8593cedd6146eabe00d270629c9cff771.tar.xz linux-267ed5d8593cedd6146eabe00d270629c9cff771.zip |
perf affinity: Add infrastructure to save/restore affinity
The kernel perf subsystem has to IPI to the target CPU for many
operations. On systems with many CPUs and when managing many events the
overhead can be dominated by lots of IPIs.
An alternative is to set up CPU affinity in the perf tool, then set up
all the events for that CPU, and then move on to the next CPU.
Add some affinity management infrastructure to enable such a model.
Used in followon patches.
Committer notes:
Use zfree() in some places, add missing stdbool.h header, some minor
coding style changes.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lore.kernel.org/lkml/20191121001522.180827-3-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/affinity.h')
-rw-r--r-- | tools/perf/util/affinity.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/affinity.h b/tools/perf/util/affinity.h new file mode 100644 index 000000000000..0ad6a18ef20c --- /dev/null +++ b/tools/perf/util/affinity.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef PERF_AFFINITY_H +#define PERF_AFFINITY_H 1 + +#include <stdbool.h> + +struct affinity { + unsigned long *orig_cpus; + unsigned long *sched_cpus; + bool changed; +}; + +void affinity__cleanup(struct affinity *a); +void affinity__set(struct affinity *a, int cpu); +int affinity__setup(struct affinity *a); + +#endif // PERF_AFFINITY_H |