]> xenbits.xensource.com Git - xen.git/commitdiff
x86/PoD: skip eager reclaim when possible
authorJan Beulich <jbeulich@suse.com>
Fri, 27 May 2016 12:48:58 +0000 (14:48 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 27 May 2016 12:48:58 +0000 (14:48 +0200)
Reclaiming pages is pointless when the cache can already satisfy all
outstanding PoD entries, and doing reclaims in that case can be very
harmful to performance when that memory gets used by the guest, but
only to store zeroes there.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
master commit: 556c69f4efb09dd06e6bce4cbb0455287f19d02e
master date: 2016-05-12 18:02:21 +0200

xen/arch/x86/mm/p2m-pod.c

index b3aa7b1feb6341f543db901cbdd89a04a5ecc624..1810eea92ddbf0ba11327b9659cd9fe92b611e0f 100644 (file)
@@ -1004,7 +1004,6 @@ static void pod_eager_record(struct p2m_domain *p2m,
 {
     struct pod_mrp_list *mrp = &p2m->pod.mrp;
 
-    ASSERT(mrp->list[mrp->idx] == INVALID_GFN);
     ASSERT(gfn != INVALID_GFN);
 
     mrp->list[mrp->idx++] =
@@ -1052,7 +1051,9 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn,
         return 0;
     }
 
-    pod_eager_reclaim(p2m);
+    /* Only reclaim if we're in actual need of more cache. */
+    if ( p2m->pod.entry_count > p2m->pod.count )
+        pod_eager_reclaim(p2m);
 
     /* Only sweep if we're actually out of memory.  Doing anything else
      * causes unnecessary time and fragmentation of superpages in the p2m. */