Documentation
¶
Overview ¶
Package platform provides OS-level helpers for CPU pinning and NUMA distribution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindNumaNode ¶ added in v1.1.0
BindNumaNode sets the calling thread's memory allocation policy to MPOL_BIND for the given NUMA node. All subsequent mmap allocations will be satisfied from that node's memory. Returns an error if the syscall fails; the caller should treat failure as non-fatal (allocations will use default policy).
func CPUForNode ¶ added in v1.1.0
CPUForNode returns the NUMA node that the given CPU belongs to. Returns 0 if the node cannot be determined (safe default).
func DistributeWorkers ¶
DistributeWorkers returns CPU IDs for numWorkers distributed across NUMA nodes. On multi-socket systems, workers are interleaved across sockets so that each socket handles roughly equal traffic. Falls back to sequential round-robin when NUMA topology is unavailable.
func ResetNumaPolicy ¶ added in v1.1.0
func ResetNumaPolicy() error
ResetNumaPolicy restores the default (local) memory allocation policy.
Types ¶
type NUMATopology ¶ added in v1.1.0
NUMATopology holds detected NUMA topology information.
func DetectNUMA ¶ added in v1.1.0
func DetectNUMA() NUMATopology
DetectNUMA probes the system's NUMA topology via sysfs. Returns NumNodes=1 if NUMA info is unavailable.