Skip to content

mrange_node_weight

Yunjeong Mun edited this page Aug 20, 2024 · 2 revisions

Important

Please read Bandwidth Expansion instead because the current document is deprecated and no longer valid.


set interleave weight for a memory range

SYNOPSIS

#include <numaif.h>
long mrange_node_weight(unsigned long start, unsigned long len,
                        const unsigned int *weights, unsigned int weight_count,
                        unsigned long flags);

Link with -lnuma.

DESCRIPTION

mrange_node_weight() sets the interleaving weight for the memory range starting with start and continuing for len bytes.

A system with multiple NUMA nodes can have multiple memories including memory-only NUMA nodes. Interleaving weight defines the ratio how the system will interleave between those memory nodes. Interleaving weight is only effective when memory policy is set by set_mempolicy(2) or mbind(2) with MPOL_INTERLEAVE_WEIGHT.

Interleaving weight is specified in weights. The weight_count argument specifies the length of the weights array. The flags does nothing for now. It is preserved for the future.

Note that mrange_node_weight() has an effect only for the subsequent new memory allocations.

Return Value

On success, mrange_node_weight() returns 0; on error, -1 is returned and errno is set to indicate the error.

Errors

EINVAL

An invalid value is specified for flags or addr and len; flags should be zero since it is for future use only; or addr + len is less than addr; or addr is not a multiple of the system page size.

ENOMEM

Kernel memory is not available.

EFAULT

Part of all of the memory range specified by weights and weight_count points outside the accessible address space.

EOPNOTSUPP

Memory policy of the memory region is not MPOL_INTERLEAVE_WEIGHT. Or, memory policy of the memory region is MPOL_INTERLEAVE_WEIGHT but also has MPOL_F_AUTO_WEIGHT flag.

Conforming to

This system call is for Linux/x86-64 only.

See also

set_mempolicy(2), mbind(2), numa(7), numactl(8)