From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: 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>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/2] xen/mm: do not assign pages to a domain until they are scrubbed
Date: Wed, 25 Mar 2026 17:54:40 +0100 [thread overview]
Message-ID: <acQTUE3Lm7-KIcRj@macbook.local> (raw)
In-Reply-To: <acQMmXyOGFe5AN2i@macbook.local>
On Wed, Mar 25, 2026 at 05:26:01PM +0100, Roger Pau Monné wrote:
> On Wed, Mar 25, 2026 at 03:56:05PM +0100, Jan Beulich wrote:
> > On 25.03.2026 11:08, Roger Pau Monne wrote:
> > > * Disallow XENMEM_decrease_reservation until the domain has finished
> > > creation would fix the issue of pages being freed while pending scrub,
> > > but it's not clear there might be other usages that would be problematic,
> > > as get_page() on non-scrubbed pages would still return success.
> >
> > I agree this is of concern.
> >
> > > --- a/xen/common/memory.c
> > > +++ b/xen/common/memory.c
> > > @@ -388,6 +388,12 @@ static void populate_physmap(struct memop_args *a)
> > > goto out;
> > > }
> > > }
> > > +
> > > + if ( assign_page(page, a->extent_order, d, memflags) )
> > > + {
> > > + free_domheap_pages(page, a->extent_order);
> >
> > The pages don't have an owner set yet, so that function will go straight
> > to free_heap_pages(), needlessly passing "true" as last argument. Correct,
> > but (for large pages, which the stashing is about) highly inefficient.
>
> My bad, I was sure I was using the same freeing function as
> alloc_domheap_pages() on failure to assign, but I clearly wasn't. I
> will switch to using free_heap_pages().
Coming back to this, I can export free_heap_pages(), but then the call
would also unconditionally have need_scrub == true, as the pages have
been allocated without scrubbing. So I don't see much benefit of
using free_heap_pages(), the more that it requires making such
function global then.
Thanks, Roger.
next prev parent reply other threads:[~2026-03-25 16:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 10:08 [PATCH 0/2] xen/mm: fix fallout from populate_physmap() deferred scrub change Roger Pau Monne
2026-03-25 10:08 ` [PATCH 1/2] xen/mm: don't unconditionally clear PGC_need_scrub in alloc_heap_pages() Roger Pau Monne
2026-03-25 13:37 ` Jan Beulich
2026-03-25 14:15 ` Ayden Bottos
2026-03-25 10:08 ` [PATCH 2/2] xen/mm: do not assign pages to a domain until they are scrubbed Roger Pau Monne
2026-03-25 14:56 ` Jan Beulich
2026-03-25 16:26 ` Roger Pau Monné
2026-03-25 16:54 ` Roger Pau Monné [this message]
2026-03-26 8:18 ` Jan Beulich
2026-03-26 8:55 ` Roger Pau Monné
2026-03-25 16:55 ` Jan Beulich
2026-03-26 8:35 ` Jan Beulich
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=acQTUE3Lm7-KIcRj@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--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.