]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
libperf cpumap: Reduce allocations and sorting in intersect
authorIan Rogers <irogers@google.com>
Thu, 13 Nov 2025 18:05:07 +0000 (10:05 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Tue, 18 Nov 2025 02:43:08 +0000 (18:43 -0800)
commitaf9e8d12b139c92e748eb2956bbef03315ea7516
tree22c1fa4063de5703832a9acee2b8909c89294885
parent289815011c91dc6532d3fff7ca1c5f0bea08b474
libperf cpumap: Reduce allocations and sorting in intersect

On hybrid platforms the CPU maps are often disjoint. Rather than copy
CPUs and trim, compute the number of common CPUs, if none early exit,
otherwise copy in an sorted order. This avoids memory allocation in
the disjoint case and avoids a second malloc and useless sort in the
previous trim cases.

Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/lib/perf/cpumap.c