From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Cc: xen-devel@lists.xenproject.org,
Bernhard Kaindl <bernhard.kaindl@cloud.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@vates.tech>,
Michal Orzel <michal.orzel@amd.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Tamas K Lengyel <tamas@tklengyel.com>
Subject: Re: [PATCH 04/11] xen: Add node argument to domain_{adjust_tot_pages,set_outstanding_pages}()
Date: Fri, 6 Jun 2025 09:57:10 +0200 [thread overview]
Message-ID: <aEKfVuoc4psv0ijg@macbook.local> (raw)
In-Reply-To: <20250314172502.53498-5-alejandro.vallejo@cloud.com>
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@cloud.com>
> ---
> 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.
next prev parent reply other threads:[~2025-06-06 7:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 17:24 [PATCH 00/11] Add support for exact-node memory claims Alejandro Vallejo
2025-03-14 17:24 ` [PATCH 01/11] xen/memory: Mask XENMEMF_node() to 8 bits Alejandro Vallejo
2025-03-17 16:33 ` Jan Beulich
2025-03-18 16:10 ` Alejandro Vallejo
2025-03-14 17:24 ` [PATCH 02/11] xen/page_alloc: Remove `claim` from domain_set_outstanding_pages() Alejandro Vallejo
2025-06-05 16:42 ` Roger Pau Monné
2025-06-10 12:23 ` Jan Beulich
2025-06-10 12:52 ` Roger Pau Monné
2025-06-10 17:51 ` Alejandro Vallejo
2025-06-10 12:37 ` Jan Beulich
2025-03-14 17:24 ` [PATCH 03/11] xen/page_alloc: Add static per-node counts of free pages Alejandro Vallejo
2025-06-05 16:46 ` Roger Pau Monné
2025-06-11 13:35 ` Jan Beulich
2025-03-14 17:24 ` [PATCH 04/11] xen: Add node argument to domain_{adjust_tot_pages,set_outstanding_pages}() Alejandro Vallejo
2025-06-06 7:57 ` Roger Pau Monné [this message]
2025-06-11 13:43 ` Jan Beulich
2025-03-14 17:24 ` [PATCH 05/11] xen: Create per-node outstanding claims Alejandro Vallejo
2025-06-06 8:14 ` Roger Pau Monné
2025-06-06 8:36 ` Roger Pau Monné
2025-03-14 17:24 ` [PATCH 06/11] xen/page_alloc: Hook per-node claims to alloc_heap_pages() Alejandro Vallejo
2025-06-06 8:22 ` Roger Pau Monné
2025-03-14 17:24 ` [PATCH 07/11] xen/page_alloc: Set node affinity when claiming pages from an exact node Alejandro Vallejo
2025-06-06 8:34 ` Roger Pau Monné
2025-06-11 13:51 ` Jan Beulich
2025-03-14 17:24 ` [PATCH 08/11] xen/memory: Enable parsing NUMA node argument in XENMEM_claim_pages Alejandro Vallejo
2025-06-06 8:51 ` Roger Pau Monné
2025-03-14 17:25 ` [PATCH 09/11] tools/xc: Add `node` argument to xc_domain_claim_pages() Alejandro Vallejo
2025-06-06 9:02 ` Roger Pau Monné
2025-03-14 17:25 ` [PATCH 10/11] tools/xl: Expose a "claim_on_node" setting in xl.cfg Alejandro Vallejo
2025-06-06 9:00 ` Roger Pau Monné
2025-03-14 17:25 ` [PATCH 11/11] docs/man: Document the new claim_on_node option Alejandro Vallejo
2025-06-06 9:03 ` Roger Pau Monné
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aEKfVuoc4psv0ijg@macbook.local \
--to=roger.pau@citrix.com \
--cc=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=bernhard.kaindl@cloud.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=tamas@tklengyel.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.