• Vlastimil Babka's avatar
    mm, thp: respect MPOL_PREFERRED policy with non-local node · 0867a57c
    Vlastimil Babka authored
    Since commit 077fcf11 ("mm/thp: allocate transparent hugepages on
    local node"), we handle THP allocations on page fault in a special way -
    for non-interleave memory policies, the allocation is only attempted on
    the node local to the current CPU, if the policy's nodemask allows the
    node.
    
    This is motivated by the assumption that THP benefits cannot offset the
    cost of remote accesses, so it's better to fallback to base pages on the
    local node (which might still be available, while huge pages are not due
    to fragmentation) than to allocate huge pages on a remote node.
    
    The nodemask check prevents us from violating e.g.  MPOL_BIND policies
    where the local node is not among the allowed nodes.  However, the
    current implementation can still give surprising results for the
    MPOL_PREFERRED policy when the preferred node is different than the
    current CPU's local node.
    
    In such case we should honor the preferred node and not use the local
    node, which is wh...
    0867a57c
mempolicy.c 70.6 KB