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

[Minios-devel] [PATCH v2 12/18] mini-os: don't allocate new pages for level 1 p2m tree



When constructing the 3 level p2m tree there is no need to allocate
new pages for the level 1 containing the p2m info for all pages. The
pages from the linear p2m list constructed by the hypervisor can be
used for that purpose.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 arch/x86/mm.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 12f7fe4..e10c2c5 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -625,11 +625,11 @@ void arch_init_p2m(unsigned long max_pfn)
 #define L2_P2M_MASK     (L2_P2M_ENTRIES - 1)    
 #define L3_P2M_MASK     (L3_P2M_ENTRIES - 1)    
     
-    unsigned long *l1_list = NULL, *l2_list = NULL, *l3_list;
+    unsigned long *l2_list = NULL, *l3_list;
     unsigned long pfn;
     
     l3_list = (unsigned long *)alloc_page(); 
-    for ( pfn=0; pfn<max_pfn; pfn++ )
+    for ( pfn = 0; pfn < max_pfn; pfn += L1_P2M_ENTRIES )
     {
         if ( !(pfn % (L1_P2M_ENTRIES * L2_P2M_ENTRIES)) )
         {
@@ -641,14 +641,8 @@ void arch_init_p2m(unsigned long max_pfn)
             }
             l3_list[(pfn >> L2_P2M_SHIFT)] = virt_to_mfn(l2_list);  
         }
-        if ( !(pfn % (L1_P2M_ENTRIES)) )
-        {
-            l1_list = (unsigned long*)alloc_page();
-            l2_list[(pfn >> L1_P2M_SHIFT) & L2_P2M_MASK] = 
-                virt_to_mfn(l1_list); 
-        }
-
-        l1_list[pfn & L1_P2M_MASK] = pfn_to_mfn(pfn); 
+        l2_list[(pfn >> L1_P2M_SHIFT) & L2_P2M_MASK] =
+            virt_to_mfn(phys_to_machine_mapping + pfn);
     }
     HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = 
         virt_to_mfn(l3_list);
-- 
2.6.6


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

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