Skip to content

set_mempolicy_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 default interleave weight for a thread and children

SYNOPSIS

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

Link with -lnuma.

DESCRIPTION

set_mempolicy_node_weight() sets interleaving weight of the calling thread, to the values specified by weights.

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 weights are only effective when memory policy is set by set_mempolicy(2) or mbind(2) with MPOL_INTERLEAVE_WEIGHT.

This system call defines the default interleaving weights for the thread. The thread default interleaving weight applies the interleaving ratio of pages in the process's address space outside of memory ranges controlled by mrange_node_weight(2). Without this system call being called, the default interleaving weight of the system will be used which is written on /sys/kernel/mm/interleave_weight/node/node*/interleave_weight.

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

Return Value

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

Errors

EINVAL

flags is invalid. flags should be 0 for now. It is for future extension only.

EOPNOTSUPP

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

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.

Conforming to

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

See also

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