From patchwork Mon Nov 19 10:16:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688385 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 8A45214D6 for ; Mon, 19 Nov 2018 10:17:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BF4F29B89 for ; Mon, 19 Nov 2018 10:17:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DE3429C25; Mon, 19 Nov 2018 10:17:12 +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 07EA829B89 for ; Mon, 19 Nov 2018 10:17:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3DB26B1A3B; Mon, 19 Nov 2018 05:17:10 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EEFCD6B1A3C; Mon, 19 Nov 2018 05:17:10 -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 D93B46B1A3D; Mon, 19 Nov 2018 05:17:10 -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 AB4E46B1A3B for ; Mon, 19 Nov 2018 05:17:10 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id j125so1655168qke.12 for ; Mon, 19 Nov 2018 02:17:10 -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=3e+9SD4JAxdeRZh8kLftsp1N0zsd/a3/5e2qa4OIJxI=; b=KSy4Wipq1QNaDM1b9pYPcYSJCTG6IDHALAo7NY1ztELihrw7Zqh2+x5XQ9mxze4VjW cg+XKNl4zzSc03VH+Atfa3ALkDA8cq22zT2WSnRlTVNIwmzHrfilE9ry7YUJxzjoPdZL NSL/KoYxMb2glFwajFcQskTTJDFdgsLTWrManoP2AOCrNEelPYydX12L/asaT4ERwmvW 8Zl9ycBgyI+q8wIRl3LsG2mOyqaAhtUvSBdy/MBJSnSZh1r/JLqUw06Mq34rqrUt7dof N3YM9/4MdwZS5UrPUAEqlbY4hLbjM2Vjii45WVOTAShyWBu0eOA26kOzC7GtjS5dOliC fOBA== 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: AGRZ1gKMlL7UNp5eFu3rqgZA8tEuV+uDTS7YZx4NMkQQRc9aEdqu6YiO rV83lThDc8lDlz6EVPCa35/Owx48mbsPKfeZbPMpd5+clO5epiRuWgzdyGL29cZdk03KmHtUrfq jOuXDl6PegeqecBzrVRgVxM//XYbJe76J0mUjBflqnn3y6RJgKZBLyHwbrhezKkYH9Q== X-Received: by 2002:a37:be02:: with SMTP id o2mr20220610qkf.133.1542622630459; Mon, 19 Nov 2018 02:17:10 -0800 (PST) X-Google-Smtp-Source: AJdET5faKmvkavbSLyRMji5cVL9UoNyelV2gmMk9zH7VzndtsJEBXKUuiERNIzxxtPfzfCGxJIit X-Received: by 2002:a37:be02:: with SMTP id o2mr20220563qkf.133.1542622629406; Mon, 19 Nov 2018 02:17:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622629; cv=none; d=google.com; s=arc-20160816; b=uk3YgI6vAwidtQakpzyH70m2SC0Mjd1033jePTv550i0aYisNKzGCefGyqaQF8/tTS 28BUMAOskjiy0aiAPxOd2x3WGDeLOVgJYsX2q5luVIJdex+LPLA/+2RmwDI4hF6SaqYG 9YluG5PTr1jdBw0UjE3tdAOnoT1KtzlWkRcE2MG/DYOPEtGOBfS/BkJVEtpEO0EFIGwk MrOZ+TTsjkVB2dMgB2XVVVkG0qWLmgP5NzOaN8mvkuGTPfSO7YmDY7/aKVnL28ysEvYM nZBgCGR/8aAghsHgqQxv7pGJ2ZRYO+6iA7m7OMomN9TsO2nWksslTtbDAF2n13IeB0S5 Sjow== 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=3e+9SD4JAxdeRZh8kLftsp1N0zsd/a3/5e2qa4OIJxI=; b=j9rRVvyuU807sbRDUPDoWOB8AQ+r3KvT5jA55CFbydqSsuXtO2NMySWijqu8WPdh1X yRMMZPNspJkop+PeX6m6q4m0GJKH+KaSs8Ac0y7SiY0uFaPkNph9g6CptY26rSiKYP4/ EoUfO1xQftY6qkVVpV50LJM9ZIrFZWJBUygFzwvszo9o8jLyhUSgUWf4kZ4j8K7x9N7c L7WRok//o0G0lmQnzpt3wDYH4ZuD+ssuWH0lrwkYveCmeWlsvePAduRnE5F626+BuDLh 0E2VIimXJ+mNiHw2OVAxtllXYGOVdzFOHVMmE9VV5YtB0bnRxgzA9F6wvYabMBOt0fyY pSoQ== 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 d12si1592659qtc.207.2018.11.19.02.17.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:17:09 -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-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) 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" Signed-off-by: David Hildenbrand Acked-by: Nadav Amit --- 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)); }