Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have read through the source defined in /source/mm/mempolicy.c. Starting at line 1178:

/* Do dynamic interleaving for a process */
static unsigned interleave_nodes(struct mempolicy *policy)
{
        unsigned nid, next;
        struct task_struct *me = current;

        nid = me->il_next;
        next = next_node(nid, policy->v.nodes);
        if (next >= MAX_NUMNODES)
                next = first_node(policy->v.nodes);
        me->il_next = next;
        return nid;
}

I am not familiar with interleave. What is interleaving in Linux exactly?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Read the comment at the beginning of the file.

 * interleave     Allocate memory interleaved over a set of nodes,
 *                with normal fallback if it fails.
 *                For VMA based allocations this interleaves based on the
 *                offset into the backing object or offset into the mapping
 *                for anonymous memory. For process policy an process counter
 *                is used.

This is a memory allocation strategy for NUMA systems, i.e. large multiprocessor computers which have multiple memory banks which can be more or less distant from each node (processor). The default policy favors memory that is close to the node where the process requesting the memory is currently running. The interleave policy rotates through a set of memory banks in order to spread the load (the idea being that this allows memory requests to be performed in parallel as they'll often be to different banks).

If you didn't know what NUMA is and you aren't familiar with massive multiprocessor architectures, this file probably won't be interesting to you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.