Documentation
¶
Overview ¶
Package hostmm provides tools for interacting with the host Linux kernel's virtual memory management subsystem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTransparentHugepageEnum ¶
GetTransparentHugepageEnum returns the currently selected option given the contents of any of /sys/kernel/mm/transparent_hugepage/{enabled,shmem_enabled,defrag}.
func NotifyCurrentMemcgPressureCallback ¶
NotifyCurrentMemcgPressureCallback requests that f is called whenever the calling process' memory cgroup indicates memory pressure of the given level, as specified by Linux's Documentation/cgroup-v1/memory.txt.
If NotifyCurrentMemcgPressureCallback succeeds, it returns a function that terminates the requested memory pressure notifications. This function may be called at most once.
func Probe ¶
func Probe(probePrivateExpedited bool) <-chan HostMemBarrier
Probe asynchronously determines host `membarrier(2)` support and, if `probePrivateExpedited` is true and the host supports it, registers for MEMBARRIER_CMD_PRIVATE_EXPEDITED. Returns a channel on which the resulting HostMemBarrier is sent back. This is meant to be used in Platform implementation constructors, which mus run before seccomp filters installation. Runs in the background to allow further platform initialization to proceed while we determine this, which can take tens of milliseconds.
func ReadTransparentHugepageEnum ¶
ReadTransparentHugepageEnum returns the currently selected option for whichever of /sys/kernel/mm/transparent_hugepage/{enabled,shmem_enabled,defrag} is specified by filename. (Only the basename is required, not the full path.)
Types ¶
type HostMemBarrier ¶
type HostMemBarrier struct {
// contains filtered or unexported fields
}
HostMemBarrier provides access to the host membarrier(2) operations that the calling process has been verified to support. It is obtained from Probe.
func (HostMemBarrier) GlobalMemoryBarrier ¶
func (h HostMemBarrier) GlobalMemoryBarrier() error
GlobalMemoryBarrier blocks until "all running threads [in the host OS] have passed through a state where all memory accesses to user-space addresses match program order between entry to and return from [GlobalMemoryBarrier]", as for membarrier(2).
Preconditions: HaveGlobalMemoryBarrier() == true.
func (HostMemBarrier) HaveGlobalMemoryBarrier ¶
func (h HostMemBarrier) HaveGlobalMemoryBarrier() bool
HaveGlobalMemoryBarrier returns true if GlobalMemoryBarrier is supported.
func (HostMemBarrier) HaveProcessMemoryBarrier ¶
func (h HostMemBarrier) HaveProcessMemoryBarrier() bool
HaveProcessMemoryBarrier returns true if ProcessMemoryBarrier is supported and registration succeeded.
func (HostMemBarrier) ProcessMemoryBarrier ¶
func (h HostMemBarrier) ProcessMemoryBarrier() error
ProcessMemoryBarrier is equivalent to GlobalMemoryBarrier, but only synchronizes with threads sharing a virtual address space (from the host OS' perspective) with the calling thread.
Preconditions: HaveProcessMemoryBarrier() == true.