From patchwork Thu Nov 22 10:06:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693829 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 16DE713AD for ; Thu, 22 Nov 2018 10:07:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06D992BA1E for ; Thu, 22 Nov 2018 10:07:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEE992BAB3; Thu, 22 Nov 2018 10:07:26 +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=ham 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 6F57A2BA1E for ; Thu, 22 Nov 2018 10:07:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 089996B2B02; Thu, 22 Nov 2018 05:07:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F2D946B2B03; Thu, 22 Nov 2018 05:07:24 -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 D7F686B2B04; Thu, 22 Nov 2018 05:07:24 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by kanga.kvack.org (Postfix) with ESMTP id AA9036B2B02 for ; Thu, 22 Nov 2018 05:07:24 -0500 (EST) Received: by mail-qt1-f198.google.com with SMTP id n95so5789594qte.16 for ; Thu, 22 Nov 2018 02:07:24 -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=E7SJgw804A+uMYHZbrOyCqZhuKJIH7X0NQ9/7PjqXlY=; b=MVVA9OoCXpUJW8VT8bjJq/yW//7mtUFX7lWhr/UPuQ6XDEAoWhYt2ystL+sAdPx/kJ gYLMKQ7gBH++0m42Omr9NrBQjmBMUVyMzq3TKVtfxKXM5o13zKgtnm+UWQgir8HXuTN9 47YInBl1mCsa+I2cLCHU3SbBqmIQJ3QZuEUMbeb5Q8LsnZggj9xa8LNb+Ur9ktLSpIB7 UmjI3/VtBruwZBXLQNDZhgFUAC30QmTTbTQHqqyQVKU7R5BFpeaJNQEtdjyedXMYKTvE RvnDC2/jJAJvJmhYlazbKBN0WgZ2yzdYib0NyY91YYtS1jYUoukwP/7rOHIEh7PDzsQF OGYw== 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: AGRZ1gI/JG+x6xOcjOO/tX5tYfDjkx7L3XwvK5/LDJgnKYTp0y7iNT8N D3uDmnhSG/ovQPX79vF31gSH7y4/pETwm8+0yok0LMMz/e7PpEhVg06cEh3CVzNAbEl16h3YsY6 fvgupYo3VJs/LevGHcYoy2ISKEhGIOVumid1tkPhQUok2cb7hDCdOUcg6XGwiQkB7Aw== X-Received: by 2002:ac8:7201:: with SMTP id a1mr9333196qtp.291.1542881244493; Thu, 22 Nov 2018 02:07:24 -0800 (PST) X-Google-Smtp-Source: AJdET5fKOK8Ci2OaspDDAx0M7Ia/WQ83SWqWugQN2GAMCwxj/eF6HyGHffWqDx13Y4enPv7j9Etu X-Received: by 2002:ac8:7201:: with SMTP id a1mr9333177qtp.291.1542881244023; Thu, 22 Nov 2018 02:07:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881244; cv=none; d=google.com; s=arc-20160816; b=XMXa3Vyocq01AqtBH7iPAZnoBxMVxpP+ytsGwVVJropSP64l1+wHxOtyDD+X02Exr8 /syQYKcbiDYFGw/a5bQ3LhJGS5kyvrzCD1CizMCJIf9cROXq1QQFzyJ8oI2RYtAjTNmH 5hnuaZXhnDNuS+aOTSgrZiBOsP/wP1PJFUe5Tg9Onr3ha6ueCIF3Q0W0BfAyf3M2zM64 XOzKKCwd8gcTLXcZQO8Mk4i1V3F41y2EVCFqF5DfJ/z68u9kunUvYnsStgh7ULvyGOm9 q79zR7F1aeo5IHw2jmxSzaaUb31JoZQzkUce8VIGvlRqf8NPH1ZrBB9X2yASv7XZ2Kb/ to2A== 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=E7SJgw804A+uMYHZbrOyCqZhuKJIH7X0NQ9/7PjqXlY=; b=yVCzdCv+IrZGwNESaNlkI8BmMtI06ytczQcSCTT6M9Q6tlBL8IlVd5fS34fK+uXAtc 1Y1h3hIT92HmElwQjkkki5acURLKypYYIiauO3Potk+UQE443MNG+80G+8jW7tuNWCsi S5nUzS6IdR6g8req18ZSu1t9JNpHhY2D8743kAVSsBmiyUCL3bLLBemEguqbKIqLXwTX z9JkcwZtHqcZhr/AY4SSLVw3oHXZMZ79Y+GtBXbaFs7t7Ev6nZ525xsXKzDg84Jp0nks 6dKyPlTMXemUs3pg4tyAE9IFc+lutrGM2lSGKHbG3d1dPQvG6g+FONYLsvBQbL8bvem8 /EBQ== 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 c19si8557331qkh.43.2018.11.22.02.07.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:07:23 -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 1C92E307D860; Thu, 22 Nov 2018 10:07:23 +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 EDE30282CD; Thu, 22 Nov 2018 10:07:19 +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 , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v2 7/8] PM / Hibernate: use pfn_to_online_page() Date: Thu, 22 Nov 2018 11:06:26 +0100 Message-Id: <20181122100627.5189-8-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.48]); Thu, 22 Nov 2018 10:07:23 +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 Let's use pfn_to_online_page() instead of pfn_to_page() when checking for saveable pages to not save/restore offline memory sections. Cc: "Rafael J. Wysocki" Cc: Pavel Machek Cc: Len Brown Cc: Andrew Morton Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Suggested-by: Michal Hocko Acked-by: Michal Hocko Acked-by: Pavel Machek Acked-by: Rafael J. Wysocki Signed-off-by: David Hildenbrand --- kernel/power/snapshot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 640b2034edd6..87e6dd57819f 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1215,8 +1215,8 @@ static struct page *saveable_highmem_page(struct zone *zone, unsigned long pfn) if (!pfn_valid(pfn)) return NULL; - page = pfn_to_page(pfn); - if (page_zone(page) != zone) + page = pfn_to_online_page(pfn); + if (!page || page_zone(page) != zone) return NULL; BUG_ON(!PageHighMem(page)); @@ -1277,8 +1277,8 @@ static struct page *saveable_page(struct zone *zone, unsigned long pfn) if (!pfn_valid(pfn)) return NULL; - page = pfn_to_page(pfn); - if (page_zone(page) != zone) + page = pfn_to_online_page(pfn); + if (!page || page_zone(page) != zone) return NULL; BUG_ON(PageHighMem(page));