From: James Clark <james.clark@linaro.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
Yicong Yang <yangyicong@hisilicon.com>,
Ravi Bangoria <ravi.bangoria@amd.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Kyle Meyer <kyle.meyer@hpe.com>, Leo Yan <leo.yan@arm.com>
Subject: Re: [PATCH v3] perf cpumap: Reduce cpu size from int to int16_t
Date: Mon, 17 Feb 2025 15:20:05 +0000 [thread overview]
Message-ID: <ad30f769-97ee-48b0-b3e2-3bce93eaf205@linaro.org> (raw)
In-Reply-To: <20250210191231.156294-1-irogers@google.com>
On 10/02/2025 7:12 pm, Ian Rogers wrote:
> 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>
> ---
> v3. Add bounds checks as suggested by Leo Yan <leo.yan@arm.com>.
> v2. Rebase and tweak commit message add Reviewed-by: Tim Chen
> <tim.c.chen@linux.intel.com>.
> ---
> tools/lib/perf/cpumap.c | 8 ++--
> tools/lib/perf/include/perf/cpumap.h | 3 +-
> tools/perf/util/cpumap.c | 68 +++++++++++++++++++---------
> tools/perf/util/env.c | 2 +-
> 4 files changed, 54 insertions(+), 27 deletions(-)
>
Reviewed-by: James Clark <james.clark@linaro.org>
next prev parent reply other threads:[~2025-02-17 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 19:12 Ian Rogers
2025-02-17 15:20 ` James Clark [this message]
2025-02-27 16:50 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad30f769-97ee-48b0-b3e2-3bce93eaf205@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kyle.meyer@hpe.com \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=tim.c.chen@linux.intel.com \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®