Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2548898imu; Mon, 19 Nov 2018 02:18:20 -0800 (PST) X-Google-Smtp-Source: AJdET5eEte0orQ9oSFy3wX6abKroiPPtBmxCTztOy8EKItbYa3JvXZdTTdzaWYpy+amK+qiqnory X-Received: by 2002:a63:955a:: with SMTP id t26mr19742050pgn.449.1542622700305; Mon, 19 Nov 2018 02:18:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622700; cv=none; d=google.com; s=arc-20160816; b=Uv2yR6wJfPtnzZHM+E5rvnPXGzfZap5/rNsjrkKlP9rCUForywOrsWnEECcO3pI+G1 V0ywxvnvNKiti7klUFNds/Dih2a6F4JdqSy/sJtEnNYKYN6OdZuxYYCtRr4yUcQUpIo8 w70gyp8xgE+No7nVU878hsvaUM5YPrZjJU9sBWy6FDhA6sL0q3MRgo+goF4aO+luDpB5 Vfbalv5kW1JSSYjaEUhJlLPU+VDEZvogdy7pHHsQVcwCLEyvqiJhpwGIJ8hCLRnWWrYe Gug3uFNygXhfwA1UUy+mQSzf8UCppbkBXcUQjDYuTUPd489BIxQK0AL0LiwWc/bpqDGp HVtg== 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=3e+9SD4JAxdeRZh8kLftsp1N0zsd/a3/5e2qa4OIJxI=; b=qN97XTk/R1w1i8GlTBiTEdNZ15CCHL74MGkBgXmQ2kw0vJ46w1BDdAk46NeB5jFD8m Kms9faNEzYEB2v7KKjOOi8GvoiXh1GjBUpjtLHtK69lc9dDw0fPUUg3gB4uLWmnIFk4x 62+ZpVWho6gYAG5rwCiSjQ+ahl9FmUx5g+sekKfaHrnLpDSNpvMRhliJS1GFcf/U4DzZ Jl3uOYQLDHOwX0DOHf95TPlInVF2dhvMKziUMxXMIOvWohW1R+sGG2NPcoVf4fsxe7Y4 XNuU3qXhgbf5iJ8RU7ak8B4+VriyLI9IhELPCmGPEoFbEvmvO2W+mprEUjNBWXpEiWE3 WNyA== 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 t136si9599026pfc.262.2018.11.19.02.18.05; Mon, 19 Nov 2018 02:18:20 -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 S1728080AbeKSUkT (ORCPT + 99 others); Mon, 19 Nov 2018 15:40:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32858 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbeKSUkS (ORCPT ); Mon, 19 Nov 2018 15:40:18 -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 4FA03306B58A; Mon, 19 Nov 2018 10:17:08 +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 57166105706D; Mon, 19 Nov 2018 10:17:03 +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 , Xavier Deguillard , Nadav Amit , Arnd Bergmann , Greg Kroah-Hartman , Julien Freche , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v1 6/8] vmw_balloon: mark inflated pages PG_offline Date: Mon, 19 Nov 2018 11:16:14 +0100 Message-Id: <20181119101616.8901-7-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.41]); Mon, 19 Nov 2018 10:17:08 +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: Xavier Deguillard Cc: Nadav Amit Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Julien Freche Cc: Andrew Morton Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Signed-off-by: David Hildenbrand --- drivers/misc/vmw_balloon.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index e6126a4b95d3..8cc8bd9a4e32 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -544,6 +544,36 @@ unsigned int vmballoon_page_order(enum vmballoon_page_size_type page_size) return page_size == VMW_BALLOON_2M_PAGE ? VMW_BALLOON_2M_ORDER : 0; } +/** + * vmballoon_mark_page_offline() - mark a page as offline + * @page: pointer for the page + * @page_size: the size of the page. + */ +static void +vmballoon_mark_page_offline(struct page *page, + enum vmballoon_page_size_type page_size) +{ + int i; + + for (i = 0; i < 1ULL << vmballoon_page_order(page_size); i++) + __SetPageOffline(page + i); +} + +/** + * vmballoon_mark_page_online() - mark a page as online + * @page: pointer for the page + * @page_size: the size of the page. + */ +static void +vmballoon_mark_page_online(struct page *page, + enum vmballoon_page_size_type page_size) +{ + int i; + + for (i = 0; i < 1ULL << vmballoon_page_order(page_size); i++) + __ClearPageOffline(page + i); +} + /** * vmballoon_page_in_frames() - returns the number of frames in a page. * @page_size: the size of the page. @@ -612,6 +642,7 @@ static int vmballoon_alloc_page_list(struct vmballoon *b, ctl->page_size); if (page) { + vmballoon_mark_page_offline(page, ctl->page_size); /* Success. Add the page to the list and continue. */ list_add(&page->lru, &ctl->pages); continue; @@ -850,6 +881,7 @@ static void vmballoon_release_page_list(struct list_head *page_list, list_for_each_entry_safe(page, tmp, page_list, lru) { list_del(&page->lru); + vmballoon_mark_page_online(page, page_size); __free_pages(page, vmballoon_page_order(page_size)); } -- 2.17.2