* [PATCH] perf: Increase MAX_NR_CPUS to 4096
@ 2024-12-05 16:51 Kyle Meyer
2024-12-05 17:36 ` Ian Rogers
0 siblings, 1 reply; 3+ messages in thread
From: Kyle Meyer @ 2024-12-05 16:51 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang, linux-perf-users,
linux-kernel
Cc: Kyle Meyer
Systems have surpassed 2048 CPUs. Increase MAX_NR_CPUS to 4096.
Bitmaps declared with MAX_NR_CPUS bits will increase from 256B to 512B,
and cpus_runtime will increase from 81960B to 163880B.
Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
---
Tested on a 32 socket Sapphire Rapids system with 3840 CPUs.
tools/lib/perf/include/internal/cpumap.h | 2 +-
tools/perf/perf.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h
index 49649eb51ce4..3cf28522004e 100644
--- a/tools/lib/perf/include/internal/cpumap.h
+++ b/tools/lib/perf/include/internal/cpumap.h
@@ -22,7 +22,7 @@ DECLARE_RC_STRUCT(perf_cpu_map) {
};
#ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS 2048
+#define MAX_NR_CPUS 4096
#endif
struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index c004dd4e65a3..3cb40965549f 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -3,7 +3,7 @@
#define _PERF_PERF_H
#ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS 2048
+#define MAX_NR_CPUS 4096
#endif
enum perf_affinity {
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf: Increase MAX_NR_CPUS to 4096
2024-12-05 16:51 [PATCH] perf: Increase MAX_NR_CPUS to 4096 Kyle Meyer
@ 2024-12-05 17:36 ` Ian Rogers
2024-12-05 18:02 ` Kyle Meyer
0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2024-12-05 17:36 UTC (permalink / raw)
To: Kyle Meyer
Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, adrian.hunter, kan.liang, linux-perf-users, linux-kernel
On Thu, Dec 5, 2024 at 9:01 AM Kyle Meyer <kyle.meyer@hpe.com> wrote:
>
> Systems have surpassed 2048 CPUs. Increase MAX_NR_CPUS to 4096.
>
> Bitmaps declared with MAX_NR_CPUS bits will increase from 256B to 512B,
> and cpus_runtime will increase from 81960B to 163880B.
>
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
This is very interesting, thanks Kyle! Just noting, having the same
#define in many places is clearly error prone and there are other
redefinitions of this value:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/bpf_skel/kwork_top.bpf.c?h=perf-tools-next#n21
I wonder I can refactor `tools/lib/perf/cpumap.c` to get rid of that
constant as it is only used when parsing from a file/string.
Could the kwork developers perhaps look at their many uses? The other
uses in the tool may be removable too.
Wrt this change, perhaps bump
`tools/perf/util/bpf_skel/kwork_top.bpf.c` too and then we merge that
while trying to remove other uses.
Thanks,
Ian
> ---
>
> Tested on a 32 socket Sapphire Rapids system with 3840 CPUs.
>
> tools/lib/perf/include/internal/cpumap.h | 2 +-
> tools/perf/perf.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h
> index 49649eb51ce4..3cf28522004e 100644
> --- a/tools/lib/perf/include/internal/cpumap.h
> +++ b/tools/lib/perf/include/internal/cpumap.h
> @@ -22,7 +22,7 @@ DECLARE_RC_STRUCT(perf_cpu_map) {
> };
>
> #ifndef MAX_NR_CPUS
> -#define MAX_NR_CPUS 2048
> +#define MAX_NR_CPUS 4096
> #endif
>
> struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);
> diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> index c004dd4e65a3..3cb40965549f 100644
> --- a/tools/perf/perf.h
> +++ b/tools/perf/perf.h
> @@ -3,7 +3,7 @@
> #define _PERF_PERF_H
>
> #ifndef MAX_NR_CPUS
> -#define MAX_NR_CPUS 2048
> +#define MAX_NR_CPUS 4096
> #endif
>
> enum perf_affinity {
> --
> 2.47.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf: Increase MAX_NR_CPUS to 4096
2024-12-05 17:36 ` Ian Rogers
@ 2024-12-05 18:02 ` Kyle Meyer
0 siblings, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2024-12-05 18:02 UTC (permalink / raw)
To: Ian Rogers
Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, adrian.hunter, kan.liang, linux-perf-users, linux-kernel
On Thu, Dec 05, 2024 at 09:36:07AM -0800, Ian Rogers wrote:
> On Thu, Dec 5, 2024 at 9:01 AM Kyle Meyer <kyle.meyer@hpe.com> wrote:
> >
> > Systems have surpassed 2048 CPUs. Increase MAX_NR_CPUS to 4096.
> >
> > Bitmaps declared with MAX_NR_CPUS bits will increase from 256B to 512B,
> > and cpus_runtime will increase from 81960B to 163880B.
> >
> > Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
>
> This is very interesting, thanks Kyle! Just noting, having the same
> #define in many places is clearly error prone and there are other
> redefinitions of this value:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/bpf_skel/kwork_top.bpf.c?h=perf-tools-next#n21
>
> I wonder I can refactor `tools/lib/perf/cpumap.c` to get rid of that
> constant as it is only used when parsing from a file/string.
>
> Could the kwork developers perhaps look at their many uses? The other
> uses in the tool may be removable too.
>
> Wrt this change, perhaps bump
> `tools/perf/util/bpf_skel/kwork_top.bpf.c` too and then we merge that
> while trying to remove other uses.
Sure, that sounds good to me. I'll send a second version.
Thanks,
Kyle Meyer
> > ---
> >
> > Tested on a 32 socket Sapphire Rapids system with 3840 CPUs.
> >
> > tools/lib/perf/include/internal/cpumap.h | 2 +-
> > tools/perf/perf.h | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h
> > index 49649eb51ce4..3cf28522004e 100644
> > --- a/tools/lib/perf/include/internal/cpumap.h
> > +++ b/tools/lib/perf/include/internal/cpumap.h
> > @@ -22,7 +22,7 @@ DECLARE_RC_STRUCT(perf_cpu_map) {
> > };
> >
> > #ifndef MAX_NR_CPUS
> > -#define MAX_NR_CPUS 2048
> > +#define MAX_NR_CPUS 4096
> > #endif
> >
> > struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);
> > diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> > index c004dd4e65a3..3cb40965549f 100644
> > --- a/tools/perf/perf.h
> > +++ b/tools/perf/perf.h
> > @@ -3,7 +3,7 @@
> > #define _PERF_PERF_H
> >
> > #ifndef MAX_NR_CPUS
> > -#define MAX_NR_CPUS 2048
> > +#define MAX_NR_CPUS 4096
> > #endif
> >
> > enum perf_affinity {
> > --
> > 2.47.1
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-05 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-05 16:51 [PATCH] perf: Increase MAX_NR_CPUS to 4096 Kyle Meyer
2024-12-05 17:36 ` Ian Rogers
2024-12-05 18:02 ` Kyle Meyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).