Categorygithub.com/lrita/numa
modulepackage
1.0.3
Repository: https://github.com/lrita/numa.git
Documentation: pkg.go.dev

# README

NUMA

Build Status GoDoc codecov Go Report Card

NUMA is a utility library, which is written in go. It help us to write some NUMA-AWARED code.

example gist:

package main

import (
	"github.com/lrita/numa"
)

type object struct {
	X int
	_ [...]byte // padding to page size.
 }

var objects = make([]object, numa.CPUCount())

func fnxxxx() {
	cpu, node := numa.GetCPUAndNode()
	objects[cpu].X = xx
}

# Functions

Available returns current platform is whether support NUMA.
Bind bind current process on those nodes which given by a bitmask.
CPUCount returns the current configured(enabled/detected) cpu count, which is different with runtime.NumCPU().
CPUPossibleCount returns the possible cpu count of current platform supported.
CPUToNode returns the node id by given cpu id.
GetCPUAndNode returns the node id and cpu id which current caller running on.
GetMemAllowedNodeMask returns the bitmask of current process allowed running nodes.
GetMemPolicy retrieves the NUMA policy of the calling process or of a memory address, depending on the setting of flags.
GetSchedAffinity writes the affinity mask of the process whose ID is pid into the input mask.
MaxNodeID returns the max id of current configured NUMA nodes.
MaxPossibleNodeID returns the max possible node id of this platform supported.
MBind sets the NUMA memory policy, which consists of a policy mode and zero or more nodes, for the memory range starting with addr and continuing for length bytes.
NewBitmask returns a bitmask, which length always rounded to a multiple of sizeof(uint64).
NodeCount returns the count of current configured NUMA nodes.
NodeMask returns the mask of current configured nodes.
NodeMemSize64 return the memory total size and free size of given node.
NodePossibleCount returns the possible NUMA nodes count of current platform supported.
NodeToCPUMask returns the cpumask of given node id.
RunningCPUMask return the cpu bitmask of current process running on.
RunningNodesMask return the bitmask of current process using NUMA nodes.
RunOnNode set current process run on given node.
RunOnNodeMask run current process to the given nodes.
This system call defines the default policy for the process.
SetSchedAffinity sets the CPU affinity mask of the process whose ID is pid to the value specified by mask.

# Constants

No description provided by the author
The memory policy of GetMemPolicy/SetMemPolicy.
look up vma using address.
query nodes allowed in cpuset.
Flags for get_mem_policy return next IL node or node of address Warning: MPOL_F_NODE is unsupported and subject to change.
MPOL_F_RELATIVE_NODES since Linux 2.6.26 A nonempty nodemask specifies node ids that are relative to the set of node ids allowed by the process's current cpuset.
MPOL_F_STATIC_NODES since Linux 2.6.26 A nonempty nodemask specifies physical node ids.
No description provided by the author
No description provided by the author
No description provided by the author
Modifies '_MOVE: lazy migrate on fault.
Move pages owned by this process to conform to mapping.
Move every page to conform to mapping.
Flags for mbind Verify existing pages in the mapping.
No description provided by the author
MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to either SetMemPolicy() or mbind().
No description provided by the author
Internal flags start here.

# Type aliases

Bitmask is used for syscall or other operation in NUMA API.