Re: [PATCH v4 48/48] perf cpumap: Give CPUs their own type.
From: Jiri Olsa <hidden>
Date: 2022-01-09 18:30:47
Also in:
linux-perf-users, lkml
On Tue, Jan 04, 2022 at 10:13:51PM -0800, Ian Rogers wrote:
A common problem is confusing CPU map indices with the CPU, by wrapping the CPU with a struct then this is avoided. This approach is similar to atomic_t. Suggested-by: John Garry <redacted> Signed-off-by: Ian Rogers <irogers@google.com>
SNIP
tools/perf/util/stat.h | 2 +- tools/perf/util/svghelper.c | 6 +- tools/perf/util/synthetic-events.c | 12 +- tools/perf/util/synthetic-events.h | 3 +- tools/perf/util/util.h | 5 +- 59 files changed, 408 insertions(+), 347 deletions(-)
that's massive ;-) did it find any mis-use of the index/value? how about the same for threads?
quoted hunk ↗ jump to hunk
diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h index 71a31ed738c9..581f9ffb4237 100644 --- a/tools/lib/perf/include/internal/cpumap.h +++ b/tools/lib/perf/include/internal/cpumap.h@@ -4,6 +4,11 @@ #include <linux/refcount.h> +/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */ +struct perf_cpu { + int cpu; +};
should we use 'int val' or 'int v' instead, so we don't have cpu.cpu ? jirka SNIP _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel