[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/11] xen/page_alloc: Set node affinity when claiming pages from an exact node



Set the domain's node affinity to the claimed node if the claim
specified an exact node. Do it immediately before making any changes in
case setting the affinity fails (even though it shouldn't).

This allows preferentially allocating from the closest NUMA node when
"exact" is not specified (e.g: p2m tables, etc).

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
---
Toolstacks can just do it themselves, but it's more error prone. If it
claimed pages from an exact node (and remember we can only hold a single
claim at a time) it makes no sense for the domain to be intentionally
allocating from NUMA nodes other than its home node.
---
 xen/common/page_alloc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index cfaa64d3b858..e69a5fcc8d31 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -586,10 +586,16 @@ int domain_set_outstanding_pages(struct domain *d, 
nodeid_t node,
 
     if ( node != NUMA_NO_NODE )
     {
-        avail_pages = pernode_avail_pages[node] - pernode_oc[node];
+        nodemask_t affinity = NODE_MASK_NONE;
 
+        avail_pages = pernode_avail_pages[node] - pernode_oc[node];
         if ( pages > avail_pages )
             goto out;
+
+        node_set(node, affinity);
+        ret = domain_set_node_affinity(d, &affinity);
+        if ( ret )
+            goto out;
     }
 
     /* yay, claim fits in available memory, stake the claim, success! */
-- 
2.48.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.