diff mbox series

[v1,5/5] xen/arm: no need to store pages in resv_page_list when domain is directly mapped

Message ID 20220330093617.3870589-6-Penny.Zheng@arm.com (mailing list archive)
State Superseded
Headers show
Series populate/unpopulate memory when domain on static | expand

Commit Message

Penny Zheng March 30, 2022, 9:36 a.m. UTC
When domain on static allocation and is directly mapped, in terms of
GPA == HPA(guest physical address == host physical address), we could use
mfn_to_page() to easily find the page, so there is no need to store pages
in resv_page_list.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
 xen/common/memory.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 2122ceeba7..2865e09a33 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -445,8 +445,11 @@  int guest_remove_page(struct domain *d, unsigned long gmfn)
      * When domain on static allocation, we shall store pages to resv_page_list,
      * so the hypercall populate_physmap could retrieve pages from it,
      * rather than allocating from heap.
+     * No need to store pages in resv_page_list when domain on static
+     * allocation and directly mapped, since we could use mfn_to_page() to
+     * easily find the page.
      */
-    if ( is_domain_on_static_allocation(d) )
+    if ( is_domain_on_static_allocation(d) && !is_domain_direct_mapped(d) )
     {
         page_list_add_tail(page, &d->resv_page_list);
         d->resv_pages++;