Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2548838imu; Mon, 19 Nov 2018 02:18:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/VNBuedjcj9byCTjh6qu2zFvQOgM//oSjZyVKjzlLxSO2CJ6AxjKdgv2TamNqVt8kDoS4/v X-Received: by 2002:a17:902:e08b:: with SMTP id cb11mr4188206plb.263.1542622695242; Mon, 19 Nov 2018 02:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622695; cv=none; d=google.com; s=arc-20160816; b=Kejm7cOYfxividiZOjA2erzfIfeGSm8o33UA3ZRlRqHmTRtuNexKE+b+GwjcuGUcAE gtaaluqgTZ3ZlnLlvHyUvydoln8attrrXq3zuq4BDMF1psgeNaeI7Abun4ym6wt8f+Nj vMEPeot2rJgG4YwQSMT5OzclV4JElga3Ev1/bzDVaDRs9ulhfo5639UEWRYCyJ5hD9xc 6nr84BilmpRQ86BbKu1UDdljMG3+8tREXM3Xgc7TE4bNwThGaIdD6I5f3JqwjOB7Ho2H xl5qP/cwNGj4b2uKnbp251uSx0AIu9UIaof0+aw51nVJlo/afy9SonKf4b8/vba39Rav jOfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=TwA/HVyIGvjTNfBkphW8rBoqbr4Q+rjX6GbLbUZP5pw=; b=jYoSJjTmzzvjoCsjTkJZxaKaLTs8+5CeRPm1260Y8PsunGRE+9s7oRgmlHQcLRhzXz 0SOholhM7tXtnUuCfYvGsYhCFbnA3+15qG8hVuSVr4t117q4XAHIiObKAdzKIG/PMM8L 7c07bs4E46jtRBaHnLsuRjvTsEaXxkFHzdsf/7XRymx1A9nGa6z/K8FvNYZqmCLJOCut O7JIAizMFEj/MzHBiaonYqh9d3sz/8L+y9HG0M93JARLsHrdbAnDsfyp7vo6zKpzRbwr 2sk2XNNiz+X3eqPdSCJxbHZWiC0F+m6oFIZ/M7FXrw2QN/3KzRnWhuzgeapOMvbEB8Z2 hTPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w31-v6si41009110pla.347.2018.11.19.02.18.00; Mon, 19 Nov 2018 02:18:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728050AbeKSUkO (ORCPT + 99 others); Mon, 19 Nov 2018 15:40:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50338 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbeKSUkN (ORCPT ); Mon, 19 Nov 2018 15:40:13 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06ED388306; Mon, 19 Nov 2018 10:17:03 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-77.ams2.redhat.com [10.36.117.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06482106222E; Mon, 19 Nov 2018 10:16:56 +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 v1 5/8] hv_balloon: mark inflated pages PG_offline Date: Mon, 19 Nov 2018 11:16:13 +0100 Message-Id: <20181119101616.8901-6-david@redhat.com> In-Reply-To: <20181119101616.8901-1-david@redhat.com> References: <20181119101616.8901-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 19 Nov 2018 10:17:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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); -- 2.17.2