Enum hwlocality::memory::binding::MemoryBindingPolicy
source · #[repr(i32)]pub enum MemoryBindingPolicy {
FirstTouch = 1,
Bind = 2,
Interleave = 3,
NextTouch = 4,
}
Expand description
Memory binding policy
Not all systems support all kinds of binding.
Topology::feature_support()
may be used to query the actual memory
binding support in the currently used operating system.
Variants§
FirstTouch = 1
Allocate each memory page individually on the local NUMA node of the thread that touches it
The given nodeset should usually be Topology::nodeset()
so that the touching thread may run and allocate on any node in the
system.
On AIX, if the nodeset is smaller, pages are allocated locally (if the local node is in the nodeset) or from a random non-local node (otherwise).
Bind = 2
Allocate memory on the specified nodes (most portable option)
The actual behavior may slightly vary between operating systems,
especially when (some of) the requested nodes are full. On Linux, by
default, the MPOL_PREFERRED_MANY
(or MPOL_PREFERRED
) policy is used.
However, if the STRICT
flag is also given, the Linux MPOL_BIND
policy is rather used.
Requires MemoryBindingSupport::bind_policy()
.
Interleave = 3
Allocate memory on the given nodes in an interleaved round-robin manner
The precise layout of the memory across multiple NUMA nodes is OS/system specific.
Interleaving can be useful when threads distributed across the specified NUMA nodes will all be accessing the whole memory range concurrently, since the interleave will then balance the memory references.
NextTouch = 4
Migrate pages on next touch
For each page bound with this policy, by next time it is touched (and next time only), it is moved from its current location to the local NUMA node of the thread where the memory reference occurred (if it needs to be moved at all).
Trait Implementations§
source§impl Arbitrary for MemoryBindingPolicy
Available on crate feature proptest
only.
impl Arbitrary for MemoryBindingPolicy
proptest
only.§type Parameters = ()
type Parameters = ()
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<Range<usize>, fn(_: usize) -> MemoryBindingPolicy>
type Strategy = Map<Range<usize>, fn(_: usize) -> MemoryBindingPolicy>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
source§impl Clone for MemoryBindingPolicy
impl Clone for MemoryBindingPolicy
source§fn clone(&self) -> MemoryBindingPolicy
fn clone(&self) -> MemoryBindingPolicy
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MemoryBindingPolicy
impl Debug for MemoryBindingPolicy
source§impl Default for MemoryBindingPolicy
impl Default for MemoryBindingPolicy
source§fn default() -> MemoryBindingPolicy
fn default() -> MemoryBindingPolicy
source§impl Display for MemoryBindingPolicy
impl Display for MemoryBindingPolicy
source§impl From<MemoryBindingPolicy> for i32
impl From<MemoryBindingPolicy> for i32
source§fn from(enum_value: MemoryBindingPolicy) -> Self
fn from(enum_value: MemoryBindingPolicy) -> Self
source§impl Hash for MemoryBindingPolicy
impl Hash for MemoryBindingPolicy
source§impl PartialEq for MemoryBindingPolicy
impl PartialEq for MemoryBindingPolicy
source§fn eq(&self, other: &MemoryBindingPolicy) -> bool
fn eq(&self, other: &MemoryBindingPolicy) -> bool
self
and other
values to be equal, and is used
by ==
.