From db956262ac4125693cffb517ea7aebf6ab04ec35 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 13 May 2025 13:12:47 -0400 Subject: runtime: rename ncpu to numCPUStartup ncpu is the total logical CPU count at startup. It is never updated. For #73193, we will start using updated CPU counts for updated GOMAXPROCS, making the ncpu name a bit ambiguous. Change to a less ambiguous name. While we're at it, give the OS specific lookup functions a common name, so it can be used outside of osinit later. For #73193. Change-Id: I6a6a636cf21cc60de36b211f3c374080849fc667 Reviewed-on: https://go-review.googlesource.com/c/go/+/672277 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek Auto-Submit: Michael Pratt --- src/runtime/vgetrandom_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime/vgetrandom_linux.go') diff --git a/src/runtime/vgetrandom_linux.go b/src/runtime/vgetrandom_linux.go index 6ab12e3c67..8f39f6d3a6 100644 --- a/src/runtime/vgetrandom_linux.go +++ b/src/runtime/vgetrandom_linux.go @@ -46,7 +46,7 @@ func vgetrandomInit() { func vgetrandomGetState() uintptr { lock(&vgetrandomAlloc.statesLock) if len(vgetrandomAlloc.states) == 0 { - num := uintptr(ncpu) // Just a reasonable size hint to start. + num := uintptr(numCPUStartup) // Just a reasonable size hint to start. stateSizeCacheAligned := (vgetrandomAlloc.stateSize + cpu.CacheLineSize - 1) &^ (cpu.CacheLineSize - 1) allocSize := (num*stateSizeCacheAligned + physPageSize - 1) &^ (physPageSize - 1) num = (physPageSize / stateSizeCacheAligned) * (allocSize / physPageSize) -- cgit v1.3