From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Julien Grall <julien@xen.org>
Cc: Luca Fancellu <Luca.Fancellu@arm.com>,
Xen-devel <xen-devel@lists.xenproject.org>,
Penny Zheng <Penny.Zheng@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Bertrand Marquis <Bertrand.Marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH 3/7] xen/p2m: put reference for superpage
Date: Mon, 13 May 2024 10:04:06 +0200 [thread overview]
Message-ID: <ZkHJdk8b35CgcjJC@macbook> (raw)
In-Reply-To: <e1cf9c7c-581d-4bec-acaf-654d40b7ac07@xen.org>
On Fri, May 10, 2024 at 10:37:53PM +0100, Julien Grall wrote:
> Hi Roger,
>
> On 09/05/2024 13:58, Roger Pau Monné wrote:
> > On Thu, May 09, 2024 at 01:12:00PM +0100, Julien Grall wrote:
> > > Hi,
> > >
> > > On 09/05/2024 12:28, Roger Pau Monné wrote:
> > > > OTOH for 1GB given the code here the page could be freed in one go,
> > > > without a chance of preempting the operation.
> > > >
> > > > Maybe you have to shatter superpages into 4K entries and then remove
> > > > them individually, as to allow for preemption to be possible by
> > > > calling put_page() for each 4K chunk?
> > > This would require to allocate some pages from the P2M pool for the tables.
> > > As the pool may be exhausted, it could be problematic when relinquishing the
> > > resources.
> >
> > Indeed, it's not ideal.
> >
> > > It may be possible to find a way to have memory available by removing other
> > > mappings first. But it feels a bit hackish and I would rather prefer if we
> > > avoid allocating any memory when relinquishing.
> >
> > Maybe it could be helpful to provide a function to put a superpage,
> > that internally calls free_domheap_pages() with the appropriate order
> > so that freeing a superpage only takes a single free_domheap_pages()
> > call.
>
> Today, free_domheap_page() is only called when the last reference is
> removed. I don't thinkt here is any guarantee that all the references will
> dropped at the same time.
I see, yes, we have no guarantee that removing the superpage entry in
the mapping domain will lead to either the whole superpage freed at
once, or not freed. The source domain may have shattered the
super-page and hence freeing might need to be done at a smaller
granularity.
> > That could reduce some of the contention around the heap_lock
> > and d->page_alloc_lock locks.
>
> From previous experience (when Hongyan and I worked on optimizing
> init_heap_pages() for Live-Update), the lock is actually not the biggest
> problem. The issue is adding the pages back to the heap (which may requiring
> merging). So as long as the pages are not freed contiguously, we may not
> gain anything.
Would it help to defer the merging to the idle context, kind of
similar to what we do with scrubbing?
Thanks, Roger.
next prev parent reply other threads:[~2024-05-13 8:04 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 8:25 [PATCH 0/7] Static shared memory followup v2 - pt2 Luca Fancellu
2024-04-23 8:25 ` [PATCH 1/7] xen/arm: Lookup bootinfo shm bank during the mapping Luca Fancellu
2024-05-06 13:24 ` Michal Orzel
2024-05-07 13:44 ` Luca Fancellu
2024-05-07 14:01 ` Michal Orzel
2024-05-07 14:12 ` Luca Fancellu
2024-04-23 8:25 ` [PATCH 2/7] xen/arm: Wrap shared memory mapping code in one function Luca Fancellu
2024-05-06 13:39 ` Michal Orzel
2024-05-07 13:57 ` Luca Fancellu
2024-05-07 14:08 ` Michal Orzel
2024-05-07 14:15 ` Luca Fancellu
2024-05-08 6:33 ` Michal Orzel
2024-04-23 8:25 ` [PATCH 3/7] xen/p2m: put reference for superpage Luca Fancellu
2024-05-07 12:26 ` Michal Orzel
2024-05-07 13:20 ` Julien Grall
2024-05-07 13:30 ` Luca Fancellu
2024-05-08 21:05 ` Julien Grall
2024-05-08 22:11 ` Julien Grall
2024-05-09 8:13 ` Roger Pau Monné
2024-05-09 9:50 ` Julien Grall
2024-05-09 11:28 ` Roger Pau Monné
2024-05-09 12:12 ` Julien Grall
2024-05-09 12:58 ` Roger Pau Monné
2024-05-10 21:37 ` Julien Grall
2024-05-13 8:04 ` Roger Pau Monné [this message]
2024-05-14 7:55 ` Luca Fancellu
2024-05-09 7:55 ` Roger Pau Monné
2024-04-23 8:25 ` [PATCH 4/7] xen/arm: Parse xen,shared-mem when host phys address is not provided Luca Fancellu
2024-05-08 12:09 ` Michal Orzel
2024-05-08 13:28 ` Luca Fancellu
2024-05-09 8:58 ` Luca Fancellu
2024-04-23 8:25 ` [PATCH 5/7] xen/arm: Rework heap page allocation outside allocate_bank_memory Luca Fancellu
2024-05-09 11:04 ` Michal Orzel
2024-04-23 8:25 ` [PATCH 6/7] xen/arm: Implement the logic for static shared memory from Xen heap Luca Fancellu
2024-05-10 9:17 ` Michal Orzel
2024-05-10 9:25 ` Luca Fancellu
2024-05-10 9:32 ` Michal Orzel
2024-05-10 9:37 ` Luca Fancellu
2024-04-23 8:25 ` [PATCH 7/7] xen/docs: Describe static shared memory when host address is not provided Luca Fancellu
2024-05-10 9:33 ` Michal Orzel
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=ZkHJdk8b35CgcjJC@macbook \
--to=roger.pau@citrix.com \
--cc=Bertrand.Marquis@arm.com \
--cc=Luca.Fancellu@arm.com \
--cc=Penny.Zheng@arm.com \
--cc=Volodymyr_Babchuk@epam.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.