aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/perf/include
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-02-10 11:12:31 -0800
committerNamhyung Kim <namhyung@kernel.org>2025-02-27 08:47:25 -0800
commitc760174401f605cf63314d3817069a40945f0e0b (patch)
tree2654c020096f7ee1986c7dc7d5524ea0428faa58 /tools/lib/perf/include
parentperf trace: Add missing perf_tool__init() (diff)
downloadlinux-c760174401f605cf63314d3817069a40945f0e0b.tar.gz
linux-c760174401f605cf63314d3817069a40945f0e0b.zip
perf cpumap: Reduce cpu size from int to int16_t
Fewer than 32k logical CPUs are currently supported by perf. A cpumap is indexed by an integer (see perf_cpu_map__cpu) yielding a perf_cpu that wraps a 4-byte int for the logical CPU - the wrapping is done deliberately to avoid confusing a logical CPU with an index into a cpumap. Using a 4-byte int within the perf_cpu is larger than required so this patch reduces it to the 2-byte int16_t. For a cpumap containing 16 entries this will reduce the array size from 64 to 32 bytes. For very large servers with lots of logical CPUs the size savings will be greater. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: James Clark <james.clark@linaro.org> Link: https://lore.kernel.org/r/20250210191231.156294-1-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/lib/perf/include')
-rw-r--r--tools/lib/perf/include/perf/cpumap.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/perf/include/perf/cpumap.h b/tools/lib/perf/include/perf/cpumap.h
index 188a667babc6..8c1ab0f9194e 100644
--- a/tools/lib/perf/include/perf/cpumap.h
+++ b/tools/lib/perf/include/perf/cpumap.h
@@ -4,10 +4,11 @@
#include <perf/core.h>
#include <stdbool.h>
+#include <stdint.h>
/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */
struct perf_cpu {
- int cpu;
+ int16_t cpu;
};
struct perf_cache {