git: f296166d7be4 - stable/13 - smp_topo(): make it idempotent
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 16 May 2023 04:11:02 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f296166d7be49b6105105344980cd45079551a9e commit f296166d7be49b6105105344980cd45079551a9e Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-05-07 18:37:42 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-05-16 04:03:37 +0000 smp_topo(): make it idempotent (cherry picked from commit d0f67f97579f7b2febf29264b1874a95056dec06) --- sys/kern/subr_smp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 0ecc13251632..8d3e398d6b54 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -645,7 +645,14 @@ struct cpu_group * smp_topo(void) { char cpusetbuf[CPUSETBUFSIZ], cpusetbuf2[CPUSETBUFSIZ]; - struct cpu_group *top; + static struct cpu_group *top = NULL; + + /* + * The first call to smp_topo() is guaranteed to occur + * during the kernel boot while we are still single-threaded. + */ + if (top != NULL) + return (top); /* * Check for a fake topology request for debugging purposes.