smp_topo(): correct allocation sizes for trivial topologies

This patch should not modify the correctness, only the clarity.

Requested and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39981
This commit is contained in:
Konstantin Belousov 2023-05-09 18:08:22 +03:00
parent d0f67f9757
commit 361c8f75a6

View File

@ -790,8 +790,8 @@ smp_topo_1level(int share, int count, int flags)
int i;
cpu = 0;
top = smp_topo_alloc(1);
packages = mp_ncpus / count;
top = smp_topo_alloc(1 + packages);
top->cg_child = child = top + 1;
top->cg_level = CG_SHARE_NONE;
for (i = 0; i < packages; i++, child++)
@ -811,7 +811,8 @@ smp_topo_2level(int l2share, int l2count, int l1share, int l1count,
int j;
cpu = 0;
top = smp_topo_alloc(1);
top = smp_topo_alloc(1 + mp_ncpus / (l2count * l1count) +
mp_ncpus / l1count);
l2g = top + 1;
top->cg_child = l2g;
top->cg_level = CG_SHARE_NONE;