dtrace: Avoid excessive pcpu allocations
commit5d12db2dafece9f6a0453c4a45c4abed6b1e15ec
authorMark Johnston <markj@FreeBSD.org>
Fri, 22 Nov 2024 13:55:20 +0000 (22 13:55 +0000)
committerMark Johnston <markj@FreeBSD.org>
Fri, 22 Nov 2024 14:04:12 +0000 (22 14:04 +0000)
tree842c8991a5b365eb78096c22564a8ea0869430b4
parent4efe531c9d50a803a28d001fab9cc3011eb1f587
dtrace: Avoid excessive pcpu allocations

We were previously allocating MAXCPU structures for several purposes,
but this is generally unnecessary and is quite excessive, especially
after MAXCPU was bumped to 1024 on amd64 and arm64.  We already are
careful to allocate only as many per-CPU tracing buffers as are needed;
extend this to other allocations.

For example, in a 2-vCPU VM, the size of a consumer state structure
drops from 64KB to 128B.  The size of the per-consumer `dts_buffer` and
`dts_aggbuffer` arrays shrink similarly.  Ditto for pre-allocations of
local and global D variable storage space.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D47667
sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
sys/cddl/dev/dtrace/dtrace_ioctl.c
sys/cddl/dev/dtrace/dtrace_load.c