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

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



On Fri, Mar 14, 2025 at 05:24:58PM +0000, Alejandro Vallejo wrote:
> 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);

You can use nodemask_of_node(node) here?

> +        if ( ret )
> +            goto out;

This seems a bit too much, specially failing the claim if the affinity
cannot be fulfilled.

If would maybe print a message if the claim is made against a
non-affine node, but that would be it.

Thanks, Roger.



 


Rackspace

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