[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v6 5/9] x86/mm: factor out pv_dec_linear_pt



Linear page table is a PV only feature. The functions used to handle
that will be moved.

Create a function for decreasing linear page table count. It is called
unconditionally from common code so the stub is empty.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/mm.c           | 25 ++++++++++++++-----------
 xen/include/asm-x86/pv/mm.h |  5 +++++
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 64950354f4..e0dfa58f95 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2413,6 +2413,18 @@ int pv_free_page_type(struct page_info *page, unsigned 
long type,
     return rc;
 }
 
+void pv_dec_linear_pt(struct page_info *ptpg, struct page_info *page,
+                      unsigned long type)
+{
+    if ( ptpg && PGT_type_equal(type, ptpg->u.inuse.type_info) )
+    {
+        ASSERT(is_pv_domain(page_get_owner(page)));
+        ASSERT(is_pv_domain(page_get_owner(ptpg)));
+
+        dec_linear_uses(page);
+        dec_linear_entries(ptpg);
+    }
+}
 
 int pv_put_final_page_type(struct page_info *page, unsigned long type,
                            bool preemptible, struct page_info *ptpg)
@@ -2422,11 +2434,7 @@ int pv_put_final_page_type(struct page_info *page, 
unsigned long type,
     /* No need for atomic update of type_info here: noone else updates it. */
     if ( rc == 0 )
     {
-        if ( ptpg && PGT_type_equal(type, ptpg->u.inuse.type_info) )
-        {
-            dec_linear_uses(page);
-            dec_linear_entries(ptpg);
-        }
+        pv_dec_linear_pt(ptpg, page, type);
         ASSERT(!page->linear_pt_count || page_get_owner(page)->is_dying);
         set_tlbflush_timestamp(page);
         smp_wmb();
@@ -2450,7 +2458,6 @@ int pv_put_final_page_type(struct page_info *page, 
unsigned long type,
     return rc;
 }
 
-
 static int _put_page_type(struct page_info *page, bool preemptible,
                           struct page_info *ptpg)
 {
@@ -2533,11 +2540,7 @@ static int _put_page_type(struct page_info *page, bool 
preemptible,
             return -EINTR;
     }
 
-    if ( ptpg && PGT_type_equal(x, ptpg->u.inuse.type_info) )
-    {
-        dec_linear_uses(page);
-        dec_linear_entries(ptpg);
-    }
+    pv_dec_linear_pt(ptpg, page, x);
 
     return 0;
 }
diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/asm-x86/pv/mm.h
index ff9089ec19..08167aa2fd 100644
--- a/xen/include/asm-x86/pv/mm.h
+++ b/xen/include/asm-x86/pv/mm.h
@@ -37,6 +37,8 @@ int pv_free_page_type(struct page_info *page, unsigned long 
type,
                       bool preemptible);
 int pv_put_final_page_type(struct page_info *page, unsigned long type,
                            bool preemptible, struct page_info *ptpg);
+void pv_dec_linear_pt(struct page_info *ptpg, struct page_info *page,
+                      unsigned long type);
 #else
 
 #include <xen/errno.h>
@@ -70,6 +72,9 @@ static inline int pv_put_final_page_type(struct page_info 
*page,
                                          struct page_info *ptpg)
 { ASSERT_UNREACHABLE(); return -EINVAL; }
 
+static inline void pv_dec_linear_pt(struct page_info *ptpg, struct page_info 
*page,
+                                    unsigned long type) {}
+
 #endif
 
 #endif /* __X86_PV_MM_H__ */
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.