From patchwork Thu Nov 22 10:06:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693827 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 562E913AD for ; Thu, 22 Nov 2018 10:07:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474FF2BA1E for ; Thu, 22 Nov 2018 10:07:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AA072BAB3; Thu, 22 Nov 2018 10:07:23 +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 C038A2BA1E for ; Thu, 22 Nov 2018 10:07:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C474B6B2AFF; Thu, 22 Nov 2018 05:07:21 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BF7566B2B00; Thu, 22 Nov 2018 05:07:21 -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 A99C36B2B01; Thu, 22 Nov 2018 05:07:21 -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 7ACA96B2AFF for ; Thu, 22 Nov 2018 05:07:21 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id c84so8926178qkb.13 for ; Thu, 22 Nov 2018 02:07:21 -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=lDTcaAXOBrX7mcSZTgN3nkJIo6FrsKIuaktJiVSfK1Q=; b=bX/a740kycr3UPDCbiwWPe62MxZ68xD/FNz4C9KyClZcNpnIjHHb0p7cfsNs0fNa/G 2OhQf6Nu+1nv/bVscaz823bSSORjPHhx1NQllXkCA8ETZ73Djc0cisFK+RvAMh8pouwf PuvH4wVFKM3/wrNUHVneckDf19nm1nDHb3ix9rr4qN6Xma3/c/9Th/kf9bf4dXT+eaAz RVuKmnUXw72wmF4GM7ihurF3hqVkQLAWLbXxNEuO//6BtsLZLvdfKRP6jDIy5wJEQQFX +z6YAxdeVvbTAVepv0uPvbcqt2/laGkPUcSnChe/K6eOoBgPNLw04LqaCfmYCNPnvEpM Rivw== 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: AGRZ1gJV4YSCSNnkhsNCiM/ewHyE4abPyRivwNNQoXSw3QfsQBnYq7zu snoSzjXH5nc8/VP1Aei65FQrz3FpXVUKDGW/p94iCqhuCHs0UV2rEH7oxxX1qlcJzZNRelJoZBN YM5x+a7EGP+8atNAgCdmPKquEezdrjYIuo4Iztlr8p8wwJerx577PHejqRLuj6djpng== X-Received: by 2002:ac8:5411:: with SMTP id b17mr9143565qtq.259.1542881241223; Thu, 22 Nov 2018 02:07:21 -0800 (PST) X-Google-Smtp-Source: AJdET5cS2EF7pIu/Y1lMW/Y4THzVLXXDhpBFpDH3OINEnrM7g30Ne7zZ6OvFekipCkL+EalT9d0y X-Received: by 2002:ac8:5411:: with SMTP id b17mr9143540qtq.259.1542881240699; Thu, 22 Nov 2018 02:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881240; cv=none; d=google.com; s=arc-20160816; b=D/GAgo9Xw9OS/MOb+PP3XvGCFmUZJiSvyw1tkCuSKy/+V42+6J0n2MSkIbYUFhlWwv sttW2O+dq4mybVCPMeqUu8d3Ktr9KN29ratfNfiGC9soZnJvEDrNYIu5pyNlJu3uHC01 Wvmv7rZv6JJ4oawpfybjpaHuU3WIq3KAJx6/ogCdA8+t8RkyjrolBaGaTu+vNf0p6+Zz uB0nhvau5xDvxdO62lm1CnuZ10ODzoak9C/IEnTWWl/q/pvlmpolTChCEGM2d8QOSc1L DkpmePCs16YteVTd//N+5cC04l4lBQVmI85dfwF2/Usxv7nahO+KhWG3OqzdmniqpHcE OBLQ== 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=lDTcaAXOBrX7mcSZTgN3nkJIo6FrsKIuaktJiVSfK1Q=; b=uY/FPj1ExErgLZ5cMnjyJFLKV2Q1LDy8Kz3VxDaPJF0YtuanYeL23vub9CiOPhs7fD 1b4/hlpdd3qClIeUgyUZ4y7yExsq4wEleG9xq3S9Dt1xnWCp6g0VbEqe3zKbrWSpBGwy ryeJJFlUCNlW/ndGlnNvdFFZwCyVRB3b03nf8jRgZVJYTErqmRYqqvIB0FdA8OZJXDpo kuNihpPM5c4LGffEnkW5wX3ID46q7XJ5wZTXEYvGWDyoFpeFz52x+szl1/0aXwd93/EH HSMJ4vIPiJJVrUTzq7QIJ8MhYVKcEjbybRsXmYRlEaFkfWFXA28WLAcoh4hjciYngfW8 MCGA== 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 k3si10659676qvo.122.2018.11.22.02.07.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:07:20 -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 A3BD3C057F9A; Thu, 22 Nov 2018 10:07:19 +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 76DED28552; Thu, 22 Nov 2018 10:07:12 +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 v2 6/8] vmw_balloon: mark inflated pages PG_offline Date: Thu, 22 Nov 2018 11:06:25 +0100 Message-Id: <20181122100627.5189-7-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.32]); Thu, 22 Nov 2018 10:07:19 +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: 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" Acked-by: Nadav Amit 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..877611b5659b 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -556,6 +556,36 @@ vmballoon_page_in_frames(enum vmballoon_page_size_type page_size) return 1 << vmballoon_page_order(page_size); } +/** + * 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 < vmballoon_page_in_frames(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 < vmballoon_page_in_frames(page_size); i++) + __ClearPageOffline(page + i); +} + /** * vmballoon_send_get_target() - Retrieve desired balloon size from the host. * @@ -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)); }