From patchwork Tue May 10 13:44:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9057661 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41838BF29F for ; Tue, 10 May 2016 13:46:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 620DB200F0 for ; Tue, 10 May 2016 13:46:30 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C5B3200E8 for ; Tue, 10 May 2016 13:46:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b07xa-0004d5-Ey; Tue, 10 May 2016 13:44:26 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b07xY-0004ct-I9 for xen-devel@lists.xenproject.org; Tue, 10 May 2016 13:44:24 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 15/92-26575-7B5E1375; Tue, 10 May 2016 13:44:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXS6fjDS3f7U8N wg7v9vBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aJ+68YC+aLVrzd2cjSwPhAsIuRk0NIIE/i 6NmlbCA2r4CdxK7OY2C2hIChxL75q8BsFgFVictnHjKD2GwC6hJtz7azdjFycIgIGEicO5oEE mYGKv8wdz0jiC0sYCWxadshdpASXgFBib87hCFK7CTazxxkmcDINQshMwtJBsLWknj46xaUrS 2xbOFrZpByZgFpieX/OCBMJ4nXF7VRVYDYvhK7L89gX8DIsYpRozi1qCy1SNfQWC+pKDM9oyQ 3MTNH19DAVC83tbg4MT01JzGpWC85P3cTIzD0GIBgB+O/bZ6HGCU5mJREeQWnGIYL8SXlp1Rm JBZnxBeV5qQWH2LU4OAQ2LZr9QVGKZa8/LxUJQneqidAdYJFqempFWmZOcDogCmV4OBREuHNA EnzFhck5hZnpkOkTjEqSonzBoMkBEASGaV5cG2wiLzEKCslzMsIdJQQT0FqUW5mCar8K0ZxDk YlYV4PkCk8mXklcNNfAS1mAlosx6YPsrgkESEl1cC4gt/ebvocE4O9RleFFW5p724P37qdYU6 M+n/Hcs3UrgAGDq85K7s+/L1T4bnzx5c7WnyL/qT8nLIre8KFWe0ea9leayuHf1ilm8mT/SRK db2W+ybhICE7rS11jVOyos82/W7ZoSTnJfHM1frTYkXXpogHwSxZ05ZI7T6z/03LhxUWJstCX jcpsRRnJBpqMRcVJwIA+PMnw8MCAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1462887861!38580723!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56723 invoked from network); 10 May 2016 13:44:22 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-6.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 10 May 2016 13:44:22 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 10 May 2016 07:44:20 -0600 Message-Id: <573201D202000078000EA201@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Tue, 10 May 2016 07:44:18 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH] x86/PoD: skip eager reclaim when possible X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_ { struct pod_mrp_list *mrp = &p2m->pod.mrp; - ASSERT(mrp->list[mrp->idx] == INVALID_GFN); ASSERT(gfn != INVALID_GFN); mrp->list[mrp->idx++] = @@ -1075,7 +1074,9 @@ p2m_pod_demand_populate(struct p2m_domai 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. */ Reviewed-by: Andrew Cooper Reviewed-by: George Dunlap --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_ { struct pod_mrp_list *mrp = &p2m->pod.mrp; - ASSERT(mrp->list[mrp->idx] == INVALID_GFN); ASSERT(gfn != INVALID_GFN); mrp->list[mrp->idx++] = @@ -1075,7 +1074,9 @@ p2m_pod_demand_populate(struct p2m_domai 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. */