From: Jan Beulich Date: Thu, 12 May 2016 16:02:21 +0000 (+0200) Subject: x86/PoD: skip eager reclaim when possible X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1124 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=556c69f4efb09dd06e6bce4cbb0455287f19d02e;p=xen.git x86/PoD: skip eager reclaim when possible 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 Reviewed-by: Andrew Cooper Release-acked-by: Wei Liu Reviewed-by: George Dunlap --- diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 35835d1d83..b7ab16916b 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -1031,7 +1031,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++] = @@ -1079,7 +1078,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. */