git: 361c8f75a618 - main - smp_topo(): correct allocation sizes for trivial topologies
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 May 2023 15:30:17 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=361c8f75a61832d9aa3dd4c589a0220f3467466f commit 361c8f75a61832d9aa3dd4c589a0220f3467466f Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-05-09 15:08:22 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-05-09 15:30:07 +0000 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 --- sys/kern/subr_smp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 5a9aeb5ab04a..5a1013dad65f 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -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;