From patchwork Thu Nov 22 10:06:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693821 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 2DD2013AD for ; Thu, 22 Nov 2018 10:07:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC7F2BA70 for ; Thu, 22 Nov 2018 10:07:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12ECA2BB0D; Thu, 22 Nov 2018 10:07:16 +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 A7E442BAB3 for ; Thu, 22 Nov 2018 10:07:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A9E36B2AFD; Thu, 22 Nov 2018 05:07:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 430126B2AFE; Thu, 22 Nov 2018 05:07:14 -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 2D1576B2AFF; Thu, 22 Nov 2018 05:07:14 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by kanga.kvack.org (Postfix) with ESMTP id EFB7A6B2AFD for ; Thu, 22 Nov 2018 05:07:13 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id 92so8913668qkx.19 for ; Thu, 22 Nov 2018 02:07: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=hXsuXdcEZ60G/VK2inNibYl/zfQ/d8rFfLdcw5yksuc=; b=TcexNtzwXI1RRylef72XJEdZl7pVbBZ7eDo7pFDr+Bd8dZvqtpZc1RrMbl9VqAo3c9 JFSbNht9ycqpV+1YJv+G/pInTxejUpxz/99P/0er2VfhD+TS5qmFMjym6OVqQzQ6EmBf sOo9jGib5J5f+CzxOYYOhBfKlSW4APRxCHMCUgjhpr3JQ2cQmbqh37FW6Eg4Y1L2weWh 89FTNkXQ0va2FTvS6I5w0ULnnVVCryZ3SvmJQJCejXohZTnSn5ie5JwluoRl03ruj99J BZtAiOOxq5scvpV0mMBu1X2Wjgu1wqsBpQL4r8USy4bw+B4vhA1FXPJ4w4RFmSDpZlgN 3JwQ== 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: AGRZ1gKUk0Nz4GK/z1pn9VBsvgromfoCVOnM6TWvHth/MRivGVkA5gQi vZtfe0SF843KbZubz1giOB79PN9bdRZP6WdwmMBhSTSqbePc0NmxuiXnQXCjEmVXbf4iuUAz7GO vxsRh2emeTYj/Lya2ciaF0s6IceuQ6AmMbG0QmD+30kFJcqLuNPGk7cqT/cZg0U8sYQ== X-Received: by 2002:ac8:43d0:: with SMTP id w16mr9404243qtn.78.1542881233759; Thu, 22 Nov 2018 02:07:13 -0800 (PST) X-Google-Smtp-Source: AJdET5fVzNcjo0cQ6eKsWU4ajKe7kU0bln0198KDVwAENVR2vwTH2c42H2ncJH9YgbASmGiX0cb0 X-Received: by 2002:ac8:43d0:: with SMTP id w16mr9404211qtn.78.1542881233182; Thu, 22 Nov 2018 02:07:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881233; cv=none; d=google.com; s=arc-20160816; b=1FCD7OCH2xnjWf5VCUR7ROVocJuLtX+DEIVfrKVNQDrVNglK+VA+YgRUuc8d8aAtLi 2U6/eiwh69y4YmFScTu4mCM8GU8cu907OUq1aRXKGaPi0UEmLRaxNFk6nhwQT7xFHvsq sSwJl3Tqy5S/pmWr5mpCaKjF6FlsH+Ze+WasMS4RwkyFfNUrTkahTndDySVgQnQ9DBIA eMqlVtIso0TWrfljFuynT97Zglbw7ToaLmJ02lSJldcw+ghm6ea9CRp/dM+rCmsUEYZ7 p6lUQpKn6IPoQCvBwSdzBYu6R8MpjrQ9TpeDApenEdNFDXWwFAy8ax7dzMG7FAmvIrU8 2mpA== 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=hXsuXdcEZ60G/VK2inNibYl/zfQ/d8rFfLdcw5yksuc=; b=gutXFoLXbKtH1YWFBrPZGmJsSkebTKHCsGNz19vviWqLwPvvWm1n7vVLnRnNmuT3/T 4b+XzclVNPEq0bWp90zsaREFaVu+yvltdDbQLPqt2aOcS3tEP8wNAQwVv2bg2hMJEwr5 6QIkOqKyhxVH1b4CVAuOz2s51i+QHQRhlakyySfzD8BUwtwm7WsheCmjnbj1/OxEO2W+ x5b3k1B3zrdWEKsTaiu+42yW5W/PuiL8tqzK+72wZ97N4eINjO5SSwz1ioyxYv201ZgY mkLOv5rEogfqxn7Z3tp5uexOAFQPfKrNbwuKR/o+950czK9DbJp2Dnp1w0d1wl7O2tGB bB0Q== 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 u16si9887277qku.262.2018.11.22.02.07.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:07:13 -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-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DBB446263; Thu, 22 Nov 2018 10:07:12 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-206.ams2.redhat.com [10.36.116.206]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6DFA16BE8; Thu, 22 Nov 2018 10:07:08 +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, kexec-ml , pv-drivers@vmware.com, David Hildenbrand , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Kairui Song , Vitaly Kuznetsov , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v2 5/8] hv_balloon: mark inflated pages PG_offline Date: Thu, 22 Nov 2018 11:06:24 +0100 Message-Id: <20181122100627.5189-6-david@redhat.com> In-Reply-To: <20181122100627.5189-1-david@redhat.com> References: <20181122100627.5189-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 22 Nov 2018 10:07:12 +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" Acked-by: Pankaj gupta 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 211f3fe3a038..47719862e57f 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); @@ -1201,6 +1206,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--; } @@ -1213,7 +1219,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) @@ -1245,6 +1251,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);