|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 04/11] xen: Add node argument to domain_{adjust_tot_pages,set_outstanding_pages}()
On Fri, Mar 14, 2025 at 05:24:55PM +0000, Alejandro Vallejo wrote:
> domain_adjust_tot_pages() decreases the outstanding claims of a domain
> as pages are allocated, so that'll need to take into account the node in
> which an allocation is done. Deallocations just pass NUMA_NO_NODE.
>
> domain_set_outstanding_pages() takes the node on which to to stake an
> exact-node claim, or NUMA_NO_NODE if it's a non-exact claim.
>
> Not a functional change, as neither function uses the arguments for
> anything yet. It's a prerequisite to simplify for the following patch
> that introduces per-node claim counts.
>
> Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
> ---
> xen/arch/x86/mm.c | 3 ++-
> xen/arch/x86/mm/mem_sharing.c | 4 ++--
> xen/common/domain.c | 2 +-
> xen/common/grant_table.c | 4 ++--
> xen/common/memory.c | 6 ++++--
> xen/common/page_alloc.c | 17 ++++++++++++-----
> xen/include/xen/mm.h | 6 ++++--
> 7 files changed, 27 insertions(+), 15 deletions(-)
>
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index bfdc8fb01949..89f87d013099 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4458,7 +4458,8 @@ int steal_page(
> page_list_del(page, &d->page_list);
>
> /* Unlink from original owner. */
> - if ( !(memflags & MEMF_no_refcount) && !domain_adjust_tot_pages(d, -1) )
> + if ( !(memflags & MEMF_no_refcount) &&
> + !domain_adjust_tot_pages(d, NUMA_NO_NODE, -1) )
> drop_dom_ref = true;
>
> nrspin_unlock(&d->page_alloc_lock);
> diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
> index da28266ef076..2551c0d86e80 100644
> --- a/xen/arch/x86/mm/mem_sharing.c
> +++ b/xen/arch/x86/mm/mem_sharing.c
> @@ -720,7 +720,7 @@ static int page_make_sharable(struct domain *d,
> if ( !validate_only )
> {
> page_set_owner(page, dom_cow);
> - drop_dom_ref = !domain_adjust_tot_pages(d, -1);
> + drop_dom_ref = !domain_adjust_tot_pages(d, NUMA_NO_NODE, -1);
> page_list_del(page, &d->page_list);
> }
>
> @@ -766,7 +766,7 @@ static int page_make_private(struct domain *d, struct
> page_info *page)
> ASSERT(page_get_owner(page) == dom_cow);
> page_set_owner(page, d);
>
> - if ( domain_adjust_tot_pages(d, 1) == 1 )
> + if ( domain_adjust_tot_pages(d, page_to_nid(page), 1) == 1 )
> get_knownalive_domain(d);
> page_list_add_tail(page, &d->page_list);
> nrspin_unlock(&d->page_alloc_lock);
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 585fd726a941..72d8d62bc1e8 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -1205,7 +1205,7 @@ int domain_kill(struct domain *d)
> rspin_barrier(&d->domain_lock);
> argo_destroy(d);
> vnuma_destroy(d->vnuma);
> - domain_set_outstanding_pages(d, 0);
> + domain_set_outstanding_pages(d, NUMA_NO_NODE, 0);
> /* fallthrough */
> case DOMDYING_dying:
> rc = domain_teardown(d);
> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> index 6c77867f8cdd..d8c5321185c6 100644
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -2403,7 +2403,7 @@ gnttab_transfer(
> }
>
> /* Okay, add the page to 'e'. */
> - if ( unlikely(domain_adjust_tot_pages(e, 1) == 1) )
> + if ( unlikely(domain_adjust_tot_pages(e, page_to_nid(page), 1) == 1)
> )
> get_knownalive_domain(e);
>
> /*
> @@ -2429,7 +2429,7 @@ gnttab_transfer(
> * page in the page total
> */
> nrspin_lock(&e->page_alloc_lock);
> - drop_dom_ref = !domain_adjust_tot_pages(e, -1);
> + drop_dom_ref = !domain_adjust_tot_pages(e, NUMA_NO_NODE, -1);
> nrspin_unlock(&e->page_alloc_lock);
>
> if ( okay /* i.e. e->is_dying due to the surrounding if() */ )
> diff --git a/xen/common/memory.c b/xen/common/memory.c
> index 8ca4e1a8425b..1ab0bac4e7da 100644
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -773,7 +773,8 @@ static long
> memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg)
>
> nrspin_lock(&d->page_alloc_lock);
> drop_dom_ref = (dec_count &&
> - !domain_adjust_tot_pages(d, -dec_count));
> + !domain_adjust_tot_pages(d, NUMA_NO_NODE,
> + -dec_count));
Nit: it would be best if dec_count is aligned with the parenthesis:
!domain_adjust_tot_pages(d, NUMA_NO_NODE,
-dec_count));
Thanks, Roger.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |