From patchwork Wed Nov 14 21:17:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10683123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0441A14E2 for ; Wed, 14 Nov 2018 21:18:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E95312B6B5 for ; Wed, 14 Nov 2018 21:18:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA4242B9C6; Wed, 14 Nov 2018 21:18:14 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED1B2B6B5 for ; Wed, 14 Nov 2018 21:18:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89B266B0269; Wed, 14 Nov 2018 16:18:13 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 84BAA6B026A; Wed, 14 Nov 2018 16:18:13 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73A516B026B; Wed, 14 Nov 2018 16:18:13 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 487786B0269 for ; Wed, 14 Nov 2018 16:18:13 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id f22so39875423qkm.11 for ; Wed, 14 Nov 2018 13:18:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=TJailTWNXQpNDYEy03pHugK1Dve9JS7oIcI0CbKyKdw=; b=RxXwj3IdPQZEspqWreLwVarLfry8rttCLmxBrugSzpHlOW9+WfoPYx4w+ZQvya+rdf BpQ2Yj3WlgPlOpSV8hHVlPP4hZmc+Papk7mHru+JjzpJtS8mV1bHnzpl5uKzHnlVbtX/ UwUXxoZ5ohoHnszRZl6vkTHmIj/ewbk/MKEsEGIKGixdRysdOnwf2Tk2/3S6U0xF4FI7 S3NisEoM5Zt56jpeEIcvOD+jFq/iC/7ikfIdSs5q7nRQIlBpiLVW/W8grL3wztqxm2zp AjxnDoURpmagN+ekAoscijskezN7NooJH5l6q9CAUgXa/0ZbUsC0Xcr+1xzLc1yfTSK5 QwlQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AGRZ1gLeldewvhHBHVvEQAIJeR1Wihinr9ldSa90IV0FWgfu+JLMI+nh zsegqDmqqnnudEkaJ0OR28akbtXW8MavOJQjf6kS98YPM0S9MxTlMo46AOF6B1JcLMA5XBN2dNo sKFTZPY0lwQm7QxTxEBYbd9Ajn9jxISK8Ed1Gx3m8r3RJbufJGGMmem5OhRDuEMCFUQ== X-Received: by 2002:a0c:af73:: with SMTP id j48mr3588168qvc.172.1542230293059; Wed, 14 Nov 2018 13:18:13 -0800 (PST) X-Google-Smtp-Source: AJdET5dFHETVcR8uyFDFyRHg1LBf80WBPccMeag2IoxopTfNmLxCck9QNx4z7VIE3DomEJnAwBoO X-Received: by 2002:a0c:af73:: with SMTP id j48mr3588141qvc.172.1542230292586; Wed, 14 Nov 2018 13:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542230292; cv=none; d=google.com; s=arc-20160816; b=MZaTSeqvyM/8oLiCwJKAIOm6tfvye+K8+JWba9mC+snZPmrTLDHSV2tp7EYt1RMjbs 0hrPBzmQcryk5gmsAFw/jcYR+5y/Fjdt0BPMTyc/As+i/hE6cNQCF3A62Zve3O1R7QJy 9SdF6Wr9Sx+2y2iCMbbWz5/U+XXflyJL1UdsV9fB6MWZ4bBuHDhfze/HPUEQWUCZ9cdN GOQFP5UozmybOeOU+SF+GojzoZVbpWAzzCGU7y1tfTH5PKrh4NAZNySq1d0mQrfjXact vCCD8oO43Bx3nhYAL5FPS2KLGXKEybjr0k70lVF7+tdDThBuwKuSyP/BcWTn0GkgM2P3 BN8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=TJailTWNXQpNDYEy03pHugK1Dve9JS7oIcI0CbKyKdw=; b=gjyPGtxzSYZzWk3Ta/mJaqPuooMAxy4dgPNpPr91MlnI/o3PxP4bWgt8PrFco4mfhY PxCT9uTSFDmxBnsyoys6LGwoWSG5SVcK91M304DNHTcYPU8XflfYkrm4xHRh1mKR08gA /uzux8vrVllQWAh1W16QPbhlqfi0SW/2BdvnhysYFe4KB8zQ7IFk0TM0jHjFMSw4fgdg 4zDZlyDpCSeS8EEK3z7mXC/UE+vDBbgvLrQ+gUnROoIdjCRFggmWC3bxp1dI5nswvZTF dOuHPR9G0ZIBMD4muUaouDWg1sxbt/ZxF25zJtr3MN+eBAiqkJaUTZ3mfEx0C7Ig8RMy Ifgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id n2si4794505qvp.28.2018.11.14.13.18.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 13:18:12 -0800 (PST) Received-SPF: pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84CCF3154852; Wed, 14 Nov 2018 21:18:11 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-99.ams2.redhat.com [10.36.116.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA65B5C8A4; Wed, 14 Nov 2018 21:17:58 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devel@linuxdriverproject.org, linux-fsdevel@vger.kernel.org, linux-pm@vger.kernel.org, xen-devel@lists.xenproject.org, David Hildenbrand , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Kairui Song , Vitaly Kuznetsov , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH RFC 5/6] hv_balloon: mark inflated pages PG_offline Date: Wed, 14 Nov 2018 22:17:03 +0100 Message-Id: <20181114211704.6381-6-david@redhat.com> In-Reply-To: <20181114211704.6381-1-david@redhat.com> References: <20181114211704.6381-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 14 Nov 2018 21:18:11 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Mark inflated and never onlined pages PG_offline, to tell the world that the content is stale and should not be dumped. Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Kairui Song Cc: Vitaly Kuznetsov Cc: Andrew Morton Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Signed-off-by: David Hildenbrand --- drivers/hv/hv_balloon.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 5728dc470eeb..778b6f879d1c 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -681,8 +681,13 @@ static struct notifier_block hv_memory_nb = { /* Check if the particular page is backed and can be onlined and online it. */ static void hv_page_online_one(struct hv_hotadd_state *has, struct page *pg) { - if (!has_pfn_is_backed(has, page_to_pfn(pg))) + if (!has_pfn_is_backed(has, page_to_pfn(pg))) { + if (!PageOffline(pg)) + __SetPageOffline(pg); return; + } + if (PageOffline(pg)) + __ClearPageOffline(pg); /* This frame is currently backed; online the page. */ __online_page_set_limits(pg); @@ -1200,6 +1205,7 @@ static void free_balloon_pages(struct hv_dynmem_device *dm, for (i = 0; i < num_pages; i++) { pg = pfn_to_page(i + start_frame); + __ClearPageOffline(pg); __free_page(pg); dm->num_pages_ballooned--; } @@ -1212,7 +1218,7 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm, struct dm_balloon_response *bl_resp, int alloc_unit) { - unsigned int i = 0; + unsigned int i, j; struct page *pg; if (num_pages < alloc_unit) @@ -1244,6 +1250,10 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm, if (alloc_unit != 1) split_page(pg, get_order(alloc_unit << PAGE_SHIFT)); + /* mark all pages offline */ + for (j = 0; j < (1 << get_order(alloc_unit << PAGE_SHIFT)); j++) + __SetPageOffline(pg + j); + bl_resp->range_count++; bl_resp->range_array[i].finfo.start_page = page_to_pfn(pg);