]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
x86/PoD: Simplify handling of the quick check
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 17 Sep 2018 15:21:53 +0000 (16:21 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Sep 2018 10:59:32 +0000 (11:59 +0100)
There is no need to duplicate the contents of the skip block.

While cleaning up this function, change 4 ints to be unsigned.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/mm/p2m-pod.c

index 29c68a4ed4557064fe4d4aa70041e38adc1c4007..5ad62d71c717e2680dbafb30da8cd120f40e83d1 100644 (file)
@@ -863,15 +863,14 @@ out:
 }
 
 static void
-p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, int count)
+p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count)
 {
     mfn_t mfns[count];
     p2m_type_t types[count];
     unsigned long *map[count];
     struct domain *d = p2m->domain;
+    unsigned int i, j, max_ref = 1;
 
-    int i, j;
-    int max_ref = 1;
 
     /* Allow an extra refcount for one shadow pt mapping in shadowed domains */
     if ( paging_mode_shadow(d) )
@@ -911,14 +910,7 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, int count)
         /* Quick zero-check */
         for ( j = 0; j < 16; j++ )
             if ( *(map[i] + j) != 0 )
-                break;
-
-        if ( j < 16 )
-        {
-            unmap_domain_page(map[i]);
-            map[i] = NULL;
-            continue;
-        }
+                goto skip;
 
         /* Try to remove the page, restoring old mapping if it fails. */
         if ( p2m_set_entry(p2m, gfns[i], INVALID_MFN, PAGE_ORDER_4K,