From patchwork Fri Dec 9 17:10:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 9468757 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 390B060586 for ; Fri, 9 Dec 2016 17:13:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24E3B28662 for ; Fri, 9 Dec 2016 17:13:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18FE128666; Fri, 9 Dec 2016 17:13:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id ABF6028662 for ; Fri, 9 Dec 2016 17:13:26 +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 1cFOgu-0006Dc-A7; Fri, 09 Dec 2016 17:10:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cFOgs-0006DP-QG for xen-devel@lists.xenproject.org; Fri, 09 Dec 2016 17:10:34 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id B8/74-24885-985EA485; Fri, 09 Dec 2016 17:10:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRWlGSWpSXmKPExsXitHRDpG7nU68 IgyOrOC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozPBw4yFdzhrmhZeZW1gfENZxcjB4eEgL/E n96ILkZODjYBA4lbl74zg4RFBFQkbu816GLk4mAWWM4ocfzBTEaQGmEBX4kzjTdYQGwWoJq7+ +6zgdi8Ah4SV9a+B6uREJCTuHmukxnEFhJQk3i7/AwLRI2gxMmZT8BsZgEJiYMvXjBPYOSehS Q1C0lqASPTKkaN4tSistQiXUMjvaSizPSMktzEzBxdQwNjvdzU4uLE9NScxKRiveT83E2MwFB gAIIdjK+6nQ8xSnIwKYnyFjN5RQjxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4DV8ApQTLEpNT61I y8wBBiVMWoKDR0mEV/4xUJq3uCAxtzgzHSJ1ilGXY9qzxU+ZhFjy8vNSpcR5d4MUCYAUZZTmw Y2ARcglRlkpYV5GoKOEeApSi3IzS1DlXzGKczAqCfOKg1zCk5lXArfpFdARTEBHzLvhDnJESS JCSqqBsWdieUzq6dXb6kQSORTsJ9dN3PHrWOLqbRuL9ba9vW7Hoj3R/aCA0LyPokzWTTtuz/9 4+sLrTscHvWY+ydkWNXopmqzRl1ziTlqGOrGxTb655PPFFXP3hk/ff89vR/ysm7K8MybUHH+b fuD1+mWn2Mxklry37mT1ftqmPcmoVzU/UDfrGJ//TyWW4oxEQy3mouJEAF1hB1uLAgAA X-Env-Sender: prvs=1442424a8=ross.lagerwall@citrix.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1481303431!75369831!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43965 invoked from network); 9 Dec 2016 17:10:32 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-14.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 9 Dec 2016 17:10:32 -0000 X-IronPort-AV: E=Sophos;i="5.33,324,1477958400"; d="scan'208";a="393994393" From: Ross Lagerwall To: Date: Fri, 9 Dec 2016 17:10:22 +0000 Message-ID: <1481303422-3733-1-git-send-email-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Cc: Juergen Gross , Ross Lagerwall , Boris Ostrovsky , David Vrabel Subject: [Xen-devel] [PATCH] xen/balloon: Only mark a page as managed when it is released 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-Virus-Scanned: ClamAV using ClamSMTP Only mark a page as managed when it is released back to the allocator. This ensures that the managed page count does not get falsely increased when a VM is running. Correspondingly change it so that pages are marked as unmanaged after getting them from the allocator. Signed-off-by: Ross Lagerwall Reviewed-by: Boris Ostrovsky --- drivers/xen/balloon.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index e4db19e..db107fa 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -180,7 +180,6 @@ static void __balloon_append(struct page *page) static void balloon_append(struct page *page) { __balloon_append(page); - adjust_managed_page_count(page, -1); } /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ @@ -201,8 +200,6 @@ static struct page *balloon_retrieve(bool require_lowmem) else balloon_stats.balloon_low--; - adjust_managed_page_count(page, 1); - return page; } @@ -478,7 +475,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages) #endif /* Relinquish the page back to the allocator. */ - __free_reserved_page(page); + free_reserved_page(page); } balloon_stats.current_pages += rc; @@ -509,6 +506,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) state = BP_EAGAIN; break; } + adjust_managed_page_count(page, -1); scrub_page(page); list_add(&page->lru, &pages); }