From patchwork Mon Nov 19 10:16:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688365 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 20EBF13AD for ; Mon, 19 Nov 2018 10:16:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 120FC299E2 for ; Mon, 19 Nov 2018 10:16:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0636129C24; Mon, 19 Nov 2018 10:16:42 +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 922A9299E2 for ; Mon, 19 Nov 2018 10:16:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B6B26B1A2B; Mon, 19 Nov 2018 05:16:40 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 63F7E6B1A2C; Mon, 19 Nov 2018 05:16:40 -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 506076B1A2D; Mon, 19 Nov 2018 05:16:40 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by kanga.kvack.org (Postfix) with ESMTP id 208556B1A2B for ; Mon, 19 Nov 2018 05:16:40 -0500 (EST) Received: by mail-qk1-f198.google.com with SMTP id d196so68241996qkb.6 for ; Mon, 19 Nov 2018 02:16:40 -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=Oq7Mm7RstKCl5jwQdxJ6ybQMpWdJOGauvDFhhJ6+35E=; b=SXSdyVJRTpJaTF14XM8S3MH9g9cUbzNyPgt4vInGiEjMcP/+cXzZyXFJO2nLA+lBAe kwBnU8OJ+3bk+mnGWAuN9EUTDCcjpJGihG1WWRQ5c7+U2/HKj5GInkueciLp527B9LGW Cjmg3+WIbdagSLuOWbzIM8Ex31txdV11OM7GTMHCGi0/Dt9Exh4VUGVkv3xr6UAYJCdt 0nlMzu8xPWNDfsAiA7DYBmjikZn4fMN8enT9zP6+oEM/CADeXZHyP1e6XaSvYASA1reK 0X/Ud92tRS802XtlnIhzgdtSbVfmMBeUZnAbFkE3kpsgsYleqrJclMOe30D6GbX5lX5i WIfg== 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: AGRZ1gL97vwfYGcELVJy6M7+z5g2vA6aEMFwA25AGf8IaeHiVo2etDcY 9N0NknPhI1l0emLJcpEQcQH/Zq/OOIhZHXWBdekUIhbB2882osRqOH8kULpQcP0DDbz1+exQ/Yq lkLmHkJJ9eY1xsLadcWPHDmzZMiARoX2+UyANfppu3sR/zpXnuohIrH94YahqP4Hw1Q== X-Received: by 2002:a37:298f:: with SMTP id p15mr19810863qkp.327.1542622599877; Mon, 19 Nov 2018 02:16:39 -0800 (PST) X-Google-Smtp-Source: AJdET5crH42Eaf7SQImAErlR2w38gaRWZLoeFplwVkH+TfKt7kCbhoLqLuf4Zzy2/iAp5PbpiPMF X-Received: by 2002:a37:298f:: with SMTP id p15mr19810814qkp.327.1542622598665; Mon, 19 Nov 2018 02:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622598; cv=none; d=google.com; s=arc-20160816; b=fDqplYQ2j1aG98uGSPtzICNqDKZcnfU9GKhqzUoXbL+ukUjCP/ccA+ocnHTDunrIaV PizmJOoicDFCM/NXrJ2KYTfSlwSspYt2fg5QiSZhNiBS5rnf0LlSsV9sx5trQRY9qF5b Zb0ES1s2fEgvvwRR9DXh8TwbAiN6sMLtzvwhiSXd9fevoC/IJpFwY2+fI4I2Kibtkxkc 5Bo9c6+hQoUmEZqkvA4J8Lmi7aWJnEdb0aE5sFoquAYSWKznrqeSD/j9arBZ4pHJL6ZP TiFTOQa4QSTusulWVz/cNW/4c5HbtrTPbaK4afXhGOa67pEJPOU7bP/sUdsXeO5eWnB1 GV2w== 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=Oq7Mm7RstKCl5jwQdxJ6ybQMpWdJOGauvDFhhJ6+35E=; b=RqLRawMLUedlfZgf+/9acg2zldY6ipJg+dT1xAAev9qOBX/LVkcYzrQ09Rf1DqAfVp bqWXqc0nAC+g/JnlVQuyCGiVOFl8BzUYCsNM+FoMOjce+bmEXHGG5aBxXl5ilX7qjNsz w+5jdG7QuCYrKF5y2PT7po+3GUfd8NpQxitYRTn4Ecxgqn+JShdPm3UnbCf5WR/vQa97 qm2SpL6ZRdHxoSbDmPwUARC8XqC+FNAina3AkdYfItn67ATBtmiI9qTragcWjPyyFMlS sYM/hvARmNpV5Cu5I8aBlPTZy4wvixxHscBz4qRhCfgPTwqJft5ZTbgwl5zvKqIRupH5 QmUw== 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 f3si11264836qkf.49.2018.11.19.02.16.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:16:38 -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 9EB02308FC5B; Mon, 19 Nov 2018 10:16:37 +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 F3674105706D; Mon, 19 Nov 2018 10:16:34 +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 , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v1 1/8] mm: balloon: update comment about isolation/migration/compaction Date: Mon, 19 Nov 2018 11:16:09 +0100 Message-Id: <20181119101616.8901-2-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.43]); Mon, 19 Nov 2018 10:16:37 +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 Commit b1123ea6d3b3 ("mm: balloon: use general non-lru movable page feature") reworked balloon handling to make use of the general non-lru movable page feature. The big comment block in balloon_compaction.h contains quite some outdated information. Let's fix this. Cc: Andrew Morton Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Signed-off-by: David Hildenbrand Acked-by: Michael S. Tsirkin --- include/linux/balloon_compaction.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h index 53051f3d8f25..cbe50da5a59d 100644 --- a/include/linux/balloon_compaction.h +++ b/include/linux/balloon_compaction.h @@ -4,15 +4,18 @@ * * Common interface definitions for making balloon pages movable by compaction. * - * Despite being perfectly possible to perform ballooned pages migration, they - * make a special corner case to compaction scans because balloon pages are not - * enlisted at any LRU list like the other pages we do compact / migrate. + * Balloon page migration makes use of the general non-lru movable page + * feature. + * + * page->private is used to reference the responsible balloon device. + * page->mapping is used in context of non-lru page migration to reference + * the address space operations for page isolation/migration/compaction. * * As the page isolation scanning step a compaction thread does is a lockless * procedure (from a page standpoint), it might bring some racy situations while * performing balloon page compaction. In order to sort out these racy scenarios * and safely perform balloon's page compaction and migration we must, always, - * ensure following these three simple rules: + * ensure following these simple rules: * * i. when updating a balloon's page ->mapping element, strictly do it under * the following lock order, independently of the far superior @@ -21,19 +24,8 @@ * +--spin_lock_irq(&b_dev_info->pages_lock); * ... page->mapping updates here ... * - * ii. before isolating or dequeueing a balloon page from the balloon device - * pages list, the page reference counter must be raised by one and the - * extra refcount must be dropped when the page is enqueued back into - * the balloon device page list, thus a balloon page keeps its reference - * counter raised only while it is under our special handling; - * - * iii. after the lockless scan step have selected a potential balloon page for - * isolation, re-test the PageBalloon mark and the PagePrivate flag - * under the proper page lock, to ensure isolating a valid balloon page - * (not yet isolated, nor under release procedure) - * - * iv. isolation or dequeueing procedure must clear PagePrivate flag under - * page lock together with removing page from balloon device page list. + * ii. isolation or dequeueing procedure must remove the page from balloon + * device page list under b_dev_info->pages_lock. * * The functions provided by this interface are placed to help on coping with * the aforementioned balloon page corner case, as well as to ensure the simple From patchwork Mon Nov 19 10:16:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688371 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 DEAD014D6 for ; Mon, 19 Nov 2018 10:16:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE8CE299E2 for ; Mon, 19 Nov 2018 10:16:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C069B29C24; Mon, 19 Nov 2018 10:16:50 +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 17912299E2 for ; Mon, 19 Nov 2018 10:16:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26F996B1A2E; Mon, 19 Nov 2018 05:16:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1F6B46B1A2F; Mon, 19 Nov 2018 05:16:48 -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 099346B1A30; Mon, 19 Nov 2018 05:16:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id D03B26B1A2E for ; Mon, 19 Nov 2018 05:16:47 -0500 (EST) Received: by mail-qk1-f199.google.com with SMTP id v74so46371682qkb.21 for ; Mon, 19 Nov 2018 02:16:47 -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=tXpwKN7AIZ0T0RbLJdqeht2I9VV2YC5Gc09AyCMNiA4=; b=ZPstXMzEnJZjYjaMc6AgQRDned+PJHVZuzEZdZHHPXi3h7Scv948SQCiroDF10kLPZ Fy5xfGMMXanyFkmG+6lhpgGRRSnFRka+2ZxBx3x363ouZ5uhQGCxE+PV4UMR8Jrl3ySa llI0xbQy15OsYv/UjfIUhVmA/Ti0Z+8FTVbz5etzp420FntdNCPGljaYHVRd9Vi8Ts3x CawgV5336U8LOTOckyr1nWhj/i9JwU/phEVCJ9+zbMQBPgewJsLFo9/GI75JP+vdDKgH GXyHQM+T+Y3i+KEpwH707tA5nhttd4mxA2U8AKh1zCDtSjW18P+pqItcccIG7oARtBIZ w7fQ== 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: AGRZ1gISCFhkMUaHUTrqelmSYYaJZTtm9BDuO0ThAN70kRzeVy2RNDeG s2x8a+42Qn4i101E+S9RrQbN/LkfC40ba9wX3QflmTDO9ddd+RTxjIFMibHRv3pa/qaN81Ut7t+ rTA9EBB2dWMzqc9iK87QlNOvvSWc8fAmfS9Qzw4DlnX6mtRApr6r0RJxsqpuqOlJAEA== X-Received: by 2002:aed:31c5:: with SMTP id 63mr20189232qth.385.1542622607565; Mon, 19 Nov 2018 02:16:47 -0800 (PST) X-Google-Smtp-Source: AJdET5cU2jPcMPo0xVZJonvSFkBjNece/QF0EHEH5tIumvp0G/753nVwgnI73RxfFNm7TDIfUKuK X-Received: by 2002:aed:31c5:: with SMTP id 63mr20189171qth.385.1542622606320; Mon, 19 Nov 2018 02:16:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622606; cv=none; d=google.com; s=arc-20160816; b=PlUBfVU7sHt+waun62nCjq+e8YCZlZ5sxpmOxiLhYG6lGlz5wgAfp7Rcbh0w7F/VkD AKzdSlQi8yGJGE5jz1Rhv5aUiTNy/h5A2evQEvvlROG2ztMbeNmtEktfFSFa5rC+n9py sY20CmgO64MJjpI4kplyq1b1HMkxPhLcKAFBYIyY6iJB8iEXPPLQEg+8jP1MdPyWOoSb kl32GEogcrWBahS8Z5sDmd2SuWdQ8BWa6+QKSgTA7symRDMJD6+m2/x2FuSWXcXE7JtO kKjbY+NlxlUZLzVg3oOLn5DSPTX3O3hQeJe2qz18kVsJy9FTEEz8kwPmtTOGHmeh1UFQ PzmA== 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=tXpwKN7AIZ0T0RbLJdqeht2I9VV2YC5Gc09AyCMNiA4=; b=jSsqCXynRpHysBWX7UUuY721lb2rojMgwb4crasAAheF28nwSGm9K8nuZFr31g8Dv9 NJzowVD+dCZg/0VWPxaFuoUJwn93670jVxk/hrCClMyWsV93axaUpQBI7PzUOkqEfGF9 IhSXwS73UhMwHqr7agsuMpUrNDwMkgMMXX+jRNQCtMxGYaBky8Y98VRknIVdtO799nbc ZlqTj/h5bKo/nv5iet1odqfAazQxKLEwgnxtUjwBlfDa8des1TtBjcsxv/ZKbWXdhNpJ IIcCYlGxEFNkCG3AEidS6Q5+PvW0tyu8f9cW+aAW4NFmk6j5a9/x5PGqrSR20ZsCh0Lf lYgA== 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 b5si14317258qtg.383.2018.11.19.02.16.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:16:46 -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 E70EFC0587FE; Mon, 19 Nov 2018 10:16:44 +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 EA249106222E; Mon, 19 Nov 2018 10:16:37 +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 , Jonathan Corbet , Alexey Dobriyan , Mike Rapoport , Andrew Morton , Christian Hansen , Vlastimil Babka , "Kirill A. Shutemov" , Stephen Rothwell , Matthew Wilcox , "Michael S. Tsirkin" , Michal Hocko , Pavel Tatashin , Alexander Duyck , Naoya Horiguchi , Miles Chen , David Rientjes , Konstantin Khlebnikov , Kazuhito Hagio Subject: [PATCH v1 2/8] mm: convert PG_balloon to PG_offline Date: Mon, 19 Nov 2018 11:16:10 +0100 Message-Id: <20181119101616.8901-3-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.32]); Mon, 19 Nov 2018 10:16:45 +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 PG_balloon was introduced to implement page migration/compaction for pages inflated in virtio-balloon. Nowadays, it is only a marker that a page is part of virtio-balloon and therefore logically offline. We also want to make use of this flag in other balloon drivers - for inflated pages or when onlining a section but keeping some pages offline (e.g. used right now by XEN and Hyper-V via set_online_page_callback()). We are going to expose this flag to dump tools like makedumpfile. But instead of exposing PG_balloon, let's generalize the concept of marking pages as logically offline, so it can be reused for other purposes later on. Rename PG_balloon to PG_offline. This is an indicator that the page is logically offline, the content stale and that it should not be touched (e.g. a hypervisor would have to allocate backing storage in order for the guest to dump an unused page). We can then e.g. exclude such pages from dumps. We replace and reuse KPF_BALLOON (23), as this shouldn't really harm (and for now the semantics stay the same). In following patches, we will make use of this bit also in other balloon drivers. While at it, document PGTABLE. Cc: Jonathan Corbet Cc: Alexey Dobriyan Cc: Mike Rapoport Cc: Andrew Morton Cc: Christian Hansen Cc: Vlastimil Babka Cc: "Kirill A. Shutemov" Cc: Stephen Rothwell Cc: Matthew Wilcox Cc: "Michael S. Tsirkin" Cc: Michal Hocko Cc: Pavel Tatashin Cc: Alexander Duyck Cc: Naoya Horiguchi Cc: Miles Chen Cc: David Rientjes Cc: Konstantin Khlebnikov Cc: Kazuhito Hagio Signed-off-by: David Hildenbrand Acked-by: Konstantin Khlebnikov Acked-by: Michael S. Tsirkin Acked-by: Pankaj gupta --- Documentation/admin-guide/mm/pagemap.rst | 9 ++++++--- fs/proc/page.c | 4 ++-- include/linux/balloon_compaction.h | 8 ++++---- include/linux/page-flags.h | 11 +++++++---- include/uapi/linux/kernel-page-flags.h | 2 +- tools/vm/page-types.c | 2 +- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Documentation/admin-guide/mm/pagemap.rst b/Documentation/admin-guide/mm/pagemap.rst index 3f7bade2c231..340a5aee9b80 100644 --- a/Documentation/admin-guide/mm/pagemap.rst +++ b/Documentation/admin-guide/mm/pagemap.rst @@ -75,9 +75,10 @@ number of times a page is mapped. 20. NOPAGE 21. KSM 22. THP - 23. BALLOON + 23. OFFLINE 24. ZERO_PAGE 25. IDLE + 26. PGTABLE * ``/proc/kpagecgroup``. This file contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Only available when @@ -118,8 +119,8 @@ Short descriptions to the page flags identical memory pages dynamically shared between one or more processes 22 - THP contiguous pages which construct transparent hugepages -23 - BALLOON - balloon compaction page +23 - OFFLINE + page is logically offline 24 - ZERO_PAGE zero page for pfn_zero or huge_zero page 25 - IDLE @@ -128,6 +129,8 @@ Short descriptions to the page flags Note that this flag may be stale in case the page was accessed via a PTE. To make sure the flag is up-to-date one has to read ``/sys/kernel/mm/page_idle/bitmap`` first. +26 - PGTABLE + page is in use as a page table IO related page flags --------------------- diff --git a/fs/proc/page.c b/fs/proc/page.c index 6c517b11acf8..378401af4d9d 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -152,8 +152,8 @@ u64 stable_page_flags(struct page *page) else if (page_count(page) == 0 && is_free_buddy_page(page)) u |= 1 << KPF_BUDDY; - if (PageBalloon(page)) - u |= 1 << KPF_BALLOON; + if (PageOffline(page)) + u |= 1 << KPF_OFFLINE; if (PageTable(page)) u |= 1 << KPF_PGTABLE; diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h index cbe50da5a59d..f111c780ef1d 100644 --- a/include/linux/balloon_compaction.h +++ b/include/linux/balloon_compaction.h @@ -95,7 +95,7 @@ extern int balloon_page_migrate(struct address_space *mapping, static inline void balloon_page_insert(struct balloon_dev_info *balloon, struct page *page) { - __SetPageBalloon(page); + __SetPageOffline(page); __SetPageMovable(page, balloon->inode->i_mapping); set_page_private(page, (unsigned long)balloon); list_add(&page->lru, &balloon->pages); @@ -111,7 +111,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon, */ static inline void balloon_page_delete(struct page *page) { - __ClearPageBalloon(page); + __ClearPageOffline(page); __ClearPageMovable(page); set_page_private(page, 0); /* @@ -141,13 +141,13 @@ static inline gfp_t balloon_mapping_gfp_mask(void) static inline void balloon_page_insert(struct balloon_dev_info *balloon, struct page *page) { - __SetPageBalloon(page); + __SetPageOffline(page); list_add(&page->lru, &balloon->pages); } static inline void balloon_page_delete(struct page *page) { - __ClearPageBalloon(page); + __ClearPageOffline(page); list_del(&page->lru); } diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 50ce1bddaf56..f91da3d0a67e 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -670,7 +670,7 @@ PAGEFLAG_FALSE(DoubleMap) #define PAGE_TYPE_BASE 0xf0000000 /* Reserve 0x0000007f to catch underflows of page_mapcount */ #define PG_buddy 0x00000080 -#define PG_balloon 0x00000100 +#define PG_offline 0x00000100 #define PG_kmemcg 0x00000200 #define PG_table 0x00000400 @@ -700,10 +700,13 @@ static __always_inline void __ClearPage##uname(struct page *page) \ PAGE_TYPE_OPS(Buddy, buddy) /* - * PageBalloon() is true for pages that are on the balloon page list - * (see mm/balloon_compaction.c). + * PageOffline() indicates that the pages is logically offline although the + * containing section is online. (e.g. inflated in a balloon driver or + * not onlined when onlining the section). + * The content of these pages is effectively stale. Such pages should not + * be touched (read/write/dump/save) except by their owner. */ -PAGE_TYPE_OPS(Balloon, balloon) +PAGE_TYPE_OPS(Offline, offline) /* * If kmemcg is enabled, the buddy allocator will set PageKmemcg() on diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h index 21b9113c69da..6f2f2720f3ac 100644 --- a/include/uapi/linux/kernel-page-flags.h +++ b/include/uapi/linux/kernel-page-flags.h @@ -32,7 +32,7 @@ #define KPF_KSM 21 #define KPF_THP 22 -#define KPF_BALLOON 23 +#define KPF_OFFLINE 23 #define KPF_ZERO_PAGE 24 #define KPF_IDLE 25 #define KPF_PGTABLE 26 diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c index 37908a83ddc2..6c38d3b862e4 100644 --- a/tools/vm/page-types.c +++ b/tools/vm/page-types.c @@ -133,7 +133,7 @@ static const char * const page_flag_names[] = { [KPF_NOPAGE] = "n:nopage", [KPF_KSM] = "x:ksm", [KPF_THP] = "t:thp", - [KPF_BALLOON] = "o:balloon", + [KPF_OFFLINE] = "o:offline", [KPF_PGTABLE] = "g:pgtable", [KPF_ZERO_PAGE] = "z:zero_page", [KPF_IDLE] = "i:idle_page", From patchwork Mon Nov 19 10:16:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688377 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 D605414D6 for ; Mon, 19 Nov 2018 10:16:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C767A29C24 for ; Mon, 19 Nov 2018 10:16:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B889829C27; Mon, 19 Nov 2018 10:16:57 +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 4830729C24 for ; Mon, 19 Nov 2018 10:16:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63F0A6B1A31; Mon, 19 Nov 2018 05:16:56 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5C8846B1A32; Mon, 19 Nov 2018 05:16:56 -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 490DA6B1A33; Mon, 19 Nov 2018 05:16:56 -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 17FBD6B1A31 for ; Mon, 19 Nov 2018 05:16:56 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id h68so68568972qke.3 for ; Mon, 19 Nov 2018 02:16:56 -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=3I1se/jK/CTgMH6a2fAsH9htJFjy8imJvpRMBm2JhTk=; b=CPSgcHwaR6C0DSB2SZa/m5NRRQyOBZjPlHUrNU2Mi8p9iaj/Y0qZ54O/bE0Iz6P71P QiegV99CB1BI0KxQEytpODdOTIEjc/7rONqtW5AdN6RJELeK1DjfzEAHjFx63Ot8q4L3 Z88ZDCvOfBauCTH4gxBsBEDrVxp1Nj1HdOBSZ5Mqs2ow5II/hk7+2uX9Rw8w5ACdkDBw hNnUbQHC7AeViygYfl4H1UjxhUCNjn+c2kqHF2F/PmxieCrB22eyqHhXgHpotFkVzD28 7kLUwXA9awhCRNM2UYObPRnvzayiAmEDLkGHhz1tGjUGzu+o4h9J67j1syWXL99O3Sey bDsQ== 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: AGRZ1gIeZTABK6WdBIaVyexXwNvd7dITyooTY9535/7xOkU2vjTxww9h 0o33jVO/z7LC2UGu/ePPuhmnsbYPOq9i3FN6W/6LLInYNWcyC/b1VdVmLsiJ8sn6kro8Pqj19lq 24v1MssQGfMMuNN/5Kuv4bp1UtngPDn6QHyV3CbKXLo5T1RR92UiUcjQbDm7pCXZ2LA== X-Received: by 2002:a0c:fccf:: with SMTP id i15mr20497219qvq.69.1542622615846; Mon, 19 Nov 2018 02:16:55 -0800 (PST) X-Google-Smtp-Source: AJdET5cww0s26lmCKPBkV/iW8DrTVH9MtmywiJiWofLFL4Lb3TqiZX+RPKnyBjX8uNgHEO/zY1k2 X-Received: by 2002:a0c:fccf:: with SMTP id i15mr20497179qvq.69.1542622614803; Mon, 19 Nov 2018 02:16:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622614; cv=none; d=google.com; s=arc-20160816; b=EdrLA0lwD/tiD03lf6yh3WbVeMe5ZHCYvzMLNgXQDxYaD//bKGjhGpXUUdAeGrK7zU qcYEs4+oDRoI6SwiIUM71n29GjUI9zpT883ym82gDEIU/Dt1V1D6BUHPoeQ1Vsk5pif8 REC0PDO8QCKZ6UYDhnOA6vAs3UlMcEx2Owog7Qx86HABtaR0sr7cXr2rwb203QqC/7uF Srk/dYbIiOPigYny0dmhJpHptz3EZgJIQqS0A0lwnQ49QYIAgxfdXbg2FF7Vdrkv5Epz Y1VKaG1kP8IQQ2IfITgDJef7kAl6HY+L8vaJPmn4KeoAk1ZZ5MSHHJEOgQvxmNuuFa6A kmbA== 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=3I1se/jK/CTgMH6a2fAsH9htJFjy8imJvpRMBm2JhTk=; b=LRrgp1UTOf4hbpBv6Huis40rS/tl8W5kW57fHJIropxxc6pCfdGRQIG9Bcms+6Vtfr MQcnxUReCgLuZnnAz917SouRMnL4b3KwcRonVDwDfyMPBvIrXFnvFhu/zsFhO1OkxLp3 f18JhOGJMdRuasYy8n0d7y8jV+SoH81GzmwAGepy/IZHUb4mV825+7S81MiBGhI8nKGX R8eie3j8cVf01CBbYDDz6bxHB/USRC/hw3E4nbHKfOYfNySNi0qcwBU199tNUr6to8BZ suUp/h8AsOZMFrPXiO8nGk+njiHS0gjgvICaDIsvDhCNuDvbH0p3dJSGnvXmsQsRzRxy T7uA== 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 g5si7016743qka.50.2018.11.19.02.16.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:16:54 -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 3A486C05E773; Mon, 19 Nov 2018 10:16:53 +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 44F9710640FE; Mon, 19 Nov 2018 10:16:45 +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 , Andrew Morton , Dave Young , "Kirill A. Shutemov" , Baoquan He , Omar Sandoval , Arnd Bergmann , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" , Lianbo Jiang , Borislav Petkov , Kazuhito Hagio Subject: [PATCH v1 3/8] kexec: export PG_offline to VMCOREINFO Date: Mon, 19 Nov 2018 11:16:11 +0100 Message-Id: <20181119101616.8901-4-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.31]); Mon, 19 Nov 2018 10:16:53 +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 Right now, pages inflated as part of a balloon driver will be dumped by dump tools like makedumpfile. While XEN is able to check in the crash kernel whether a certain pfn is actuall backed by memory in the hypervisor (see xen_oldmem_pfn_is_ram) and optimize this case, dumps of other balloon inflated memory will essentially result in zero pages getting allocated by the hypervisor and the dump getting filled with this data. The allocation and reading of zero pages can directly be avoided if a dumping tool could know which pages only contain stale information not to be dumped. We now have PG_offline which can be (and already is by virtio-balloon) used for marking pages as logically offline. Follow up patches will make use of this flag also in other balloon implementations. Let's export PG_offline via PAGE_OFFLINE_MAPCOUNT_VALUE, so makedumpfile can directly skip pages that are logically offline and the content therefore stale. Please note that this is also helpful for a problem we were seeing under Hyper-V: Dumping logically offline memory (pages kept fake offline while onlining a section via online_page_callback) would under some condicions result in a kernel panic when dumping them. Cc: Andrew Morton Cc: Dave Young Cc: "Kirill A. Shutemov" Cc: Baoquan He Cc: Omar Sandoval Cc: Arnd Bergmann Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Cc: Lianbo Jiang Cc: Borislav Petkov Cc: Kazuhito Hagio Signed-off-by: David Hildenbrand Acked-by: Michael S. Tsirkin Acked-by: Dave Young --- kernel/crash_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 933cb3e45b98..093c9f917ed0 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -464,6 +464,8 @@ static int __init crash_save_vmcoreinfo_init(void) VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE); #ifdef CONFIG_HUGETLB_PAGE VMCOREINFO_NUMBER(HUGETLB_PAGE_DTOR); +#define PAGE_OFFLINE_MAPCOUNT_VALUE (~PG_offline) + VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE); #endif arch_crash_save_vmcoreinfo(); From patchwork Mon Nov 19 10:16:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688379 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 C110514D6 for ; Mon, 19 Nov 2018 10:17:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADDC029C24 for ; Mon, 19 Nov 2018 10:17:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A24D629C27; Mon, 19 Nov 2018 10:17:00 +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 36A1829C24 for ; Mon, 19 Nov 2018 10:17:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10E966B1A34; Mon, 19 Nov 2018 05:16:59 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 09A0E6B1A35; Mon, 19 Nov 2018 05:16:58 -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 E55506B1A36; Mon, 19 Nov 2018 05:16:58 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by kanga.kvack.org (Postfix) with ESMTP id B461D6B1A34 for ; Mon, 19 Nov 2018 05:16:58 -0500 (EST) Received: by mail-qk1-f198.google.com with SMTP id z126so67971803qka.10 for ; Mon, 19 Nov 2018 02:16:58 -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=Nxtv3n9rUX3Umq56CPsblAVXzZrf0zdjcbISE72CVEo=; b=mwRM4KnVwUaCCfgdqeKiSxhSyS8vAPS1UOkQt2U6Ye+lZOyqBpAPzwcQXz8+ZOV9bz Ry3fHq+ENVyh9khBk8Rvh1X4c/Z+dfrf5bHe6PV9ZQ1e8ReUqbFOPCf6jBXgKKF1Jl6X vgDqlwYnG6VWcsIC2kNsY88GRQFiqY4Om5cSPhFx4xahY3NqeCRDq/wHCZQys6OQMKGZ 5kDuX9fab91gklxjl1fbHL53Ct+fxHhJAkeEpdSkAMAzzEtVxJL9vpGTgIdEN57MZL7V KPlUeEyulBVav8MUdAzDi6rNCf+4Iz9cVHpNcu7xctYOuR74ngKM0qmMbyKZcB6A/qDv EkTQ== 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: AGRZ1gILedwDY0knXVsmCHSucly1ZhjuMbYLcfwpSrLQWkn7IvwJXdg6 a2gXB7rA+10Jd3SWhRpaXy7oOCK9egBLDR+FPRI4QFM7iDsdBK0dfRQj9HRWWB461DQ70nmQiiz 48W+WMZPukRIN308fFVmxDUwYkhuT4edvDyAZo1niP7kj+kTILAS/fW8zYx8vry0o1w== X-Received: by 2002:aed:2185:: with SMTP id l5mr20704529qtc.276.1542622618502; Mon, 19 Nov 2018 02:16:58 -0800 (PST) X-Google-Smtp-Source: AJdET5eKLnXg6Fi4nkNthH32vpB48kgFVEc/zJCnYW3Komyk5v9trM/zqnfhtyh0riSmCFWHm9eg X-Received: by 2002:aed:2185:: with SMTP id l5mr20704488qtc.276.1542622617748; Mon, 19 Nov 2018 02:16:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622617; cv=none; d=google.com; s=arc-20160816; b=eeDiY2/IbiFaR0oqmLvdA/u6meXtveE0qxz/ZwlmevspZ/UOOkiBCzZ1p80UridLYc 5zbB/f5BdAGUwjrmvABswiEj73qXyUtGv0sc2tUs3IWz5R5otlz9uazQJwalcizO5Nyn dbubX4z3AwOFXzH3kGaS251KgUh1g2qYKI3otELqt8EUOZyKeZjAL94UHmRw+d4lA3RV j28FFjK1Q9vh8exs8lqJ/6xKhE4GEFosDTY6brRXQJsIhpS2OvMy+o2d8ioGGVVsmXa9 K+Q1mR/ha3T61kksBqvtfazqnnYjy6PGlq+qSWyYSckb/5P2p3w7nmTDjiZO9GdP19oZ wPIQ== 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=Nxtv3n9rUX3Umq56CPsblAVXzZrf0zdjcbISE72CVEo=; b=K55L2tZwX2MeoOaIax9EOLY5j742BE5mRV9IqTvUsjkjlztNkiizsPPummFH92dfAL INSNGbO80Oqb85HHLfdiINb55NuKkKVh+0Tn6ifXcJEEFe569m4XVaR62pYQGwynj13V 5EH4xGU2cCqI8JhOYG37gVZv0S69p4feDm1btdb5zjharexstY1U2jHgShao8EK83fzE BikFCl18fFwmJnSEdsO1fQ+iC3hSkyHdFMMTNLgodgPFbSiklYYT2iEa/6etzZPIIHTk MMKD7xiGvDE2jKr9REnFZjqanqXdUbS0Ixo1XrmxIrYa+cwQPYNqxZG7cHmhVqU0Q9cy 9E4g== 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 n14si4434063qvo.171.2018.11.19.02.16.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:16:57 -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 B088E3084243; Mon, 19 Nov 2018 10:16:56 +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 81DA3105706D; Mon, 19 Nov 2018 10:16:53 +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 , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v1 4/8] xen/balloon: mark inflated pages PG_offline Date: Mon, 19 Nov 2018 11:16:12 +0100 Message-Id: <20181119101616.8901-5-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.40]); Mon, 19 Nov 2018 10:16:57 +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: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: Andrew Morton Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Signed-off-by: David Hildenbrand --- drivers/xen/balloon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 12148289debd..14dd6b814db3 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -425,6 +425,7 @@ static int xen_bring_pgs_online(struct page *pg, unsigned int order) for (i = 0; i < size; i++) { p = pfn_to_page(start_pfn + i); __online_page_set_limits(p); + __SetPageOffline(p); __balloon_append(p); } mutex_unlock(&balloon_mutex); @@ -493,6 +494,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages) xenmem_reservation_va_mapping_update(1, &page, &frame_list[i]); /* Relinquish the page back to the allocator. */ + __ClearPageOffline(page); free_reserved_page(page); } @@ -519,6 +521,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) state = BP_EAGAIN; break; } + __SetPageOffline(page); adjust_managed_page_count(page, -1); xenmem_reservation_scrub_page(page); list_add(&page->lru, &pages); From patchwork Mon Nov 19 10:16:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688381 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 1C5AA13AD for ; Mon, 19 Nov 2018 10:17:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C77D29B89 for ; Mon, 19 Nov 2018 10:17:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00CC729C2F; Mon, 19 Nov 2018 10:17:06 +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 72DAE29C25 for ; Mon, 19 Nov 2018 10:17:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63F026B1A38; Mon, 19 Nov 2018 05:17:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5EE6B6B1A39; Mon, 19 Nov 2018 05:17:05 -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 4B7756B1A3A; Mon, 19 Nov 2018 05:17:05 -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 1E2586B1A38 for ; Mon, 19 Nov 2018 05:17:05 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id a199so67595056qkb.23 for ; Mon, 19 Nov 2018 02:17:05 -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=TwA/HVyIGvjTNfBkphW8rBoqbr4Q+rjX6GbLbUZP5pw=; b=bag2j/pm+wZQmj5LI0SL4WmJSBuFhfs0GpqZ3cI24yzItibq7AJgjn/FX78865xkpp w8fZPeLfZj/zzm0tmcf5JxCeWLtQYOb5jgwoJKNyQ9Nq4OR9eUrp+fvq9N49WWBJyXpV J6eu101/qARPiL//2qD4pjdtNXEc/AV58t4BS7ruoqkCR0KV6GsjMH2jsqCghjlt3pk/ dSaCKUUPwkCv2G/Dft+jXM/pXxs+V3uEk7rWK8cY+7fnUtAYW5Cynfl6nK66J8HMGNbE bawE2wdZcQYtnoBuvd0xlkmP8dkHG2xs6kszoW7laRQNxUafHB63s2UyeOjpud4GmmUU q68g== 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: AGRZ1gJWJy0GAhcyPN/sVs0QcEddahBuTg9gk8feI7DnWE/Za+GFIWqY zdKcOaP4DwfaAnrDVGgAMEz+l+mwzLEJyhE7kc1nU4W3nOTqM7b0dDwfrvlRGgKY9idLrvABQii X6JEgIzAVyloPQna42kKzMRJkf31joV8KJvy4k4i8GOfdMR6FYBhPATU8AfLgY+T9Ug== X-Received: by 2002:a37:d1c5:: with SMTP id o66mr20407636qkl.293.1542622624893; Mon, 19 Nov 2018 02:17:04 -0800 (PST) X-Google-Smtp-Source: AJdET5duADO4Bdvmxz9LJtm47tJ/I7dRryJcjt2N6Z7/YzGP7yO83PUN5VfUPXIt/xz7VYvvbD7/ X-Received: by 2002:a37:d1c5:: with SMTP id o66mr20407594qkl.293.1542622624014; Mon, 19 Nov 2018 02:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622623; cv=none; d=google.com; s=arc-20160816; b=To15KFpQgmAW/xcKfDjr5mtDqlZ/1lY7NA9tL7vGNp6u6xyuTgBcZAwF64/DH/Gobv rQnharyJw2x0iOI8x5zi5yedm99kOcVv6pzYvy+MJ4wQKppDz6Q8UdyDuP5pjeJTMTJT DB9GQ0+qTHPOK+UQqdgBq0/s/noeqsTEFJIOrF3tv7QyLtkGGyhR7sX6QRayLcoK+s3z /Q1uNwyx53lCYrWcLFIwgFv9vQnCUybP0bPSETlQY/QSTr4dHpT1SSvLtNFL/pxsK3f4 gsX/4yOH/bjfnwJ74IbmjP+t8PSdFAip2HPWPqMKIqqd/nvOsA/hy/xrB+dbEIaEvfHo b/xw== 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=TwA/HVyIGvjTNfBkphW8rBoqbr4Q+rjX6GbLbUZP5pw=; b=WDSVoQzknfiMwxn2ypU0RRtx9LFbKpweupzPUjlL9sIGgf5MTzzyXi4XtTkk3MQenX CIm64MdQXjoJlwTT6lFi15WPVpgnreXJspSrcMm95ZMpz/dDZyvS/KGyRIk1riEwo0R8 b1tFvEAU/T78LeYFYX1PD9xVpVUOrGSCgGPUNLQO5QMLORpe4FGfbhGf3zi9XnfyMGY0 b0F7va9QHbT/SBw/tfgKiCIBlK+hLeOBp5stMIXDcYYIwnxarypRxAknV9bvGf7VKpew /LBo0wSr1KD1M31NciO4UgzMqPmYIb2W7k1ZbDL41eRBEnaY3l6QRPNgA9+1z+37PwsX S9Kw== 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 x7si22078903qtd.254.2018.11.19.02.17.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:17:03 -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 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) 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: "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 Acked-by: Pankaj gupta --- 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); 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)); } From patchwork Mon Nov 19 10:16:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688389 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 652D914D6 for ; Mon, 19 Nov 2018 10:17:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5574329B89 for ; Mon, 19 Nov 2018 10:17:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4990B29C25; Mon, 19 Nov 2018 10:17:19 +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 0414129B89 for ; Mon, 19 Nov 2018 10:17:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7BFF6B1A3E; Mon, 19 Nov 2018 05:17:16 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E2BBD6B1A3F; Mon, 19 Nov 2018 05:17:16 -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 CF45E6B1A40; Mon, 19 Nov 2018 05:17:16 -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 9915D6B1A3E for ; Mon, 19 Nov 2018 05:17:16 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id k203so68580361qke.2 for ; Mon, 19 Nov 2018 02:17:16 -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=atUER95Er8vxVyyJe2WQJsrmwnJCko1YRxZJ2dnB2Zs=; b=H9aD0CpzqcvdYHoO08+2pL1+JmDmC9cf1Qq+IEDTlu3GTNN3kEVXn5VQe8dKjm98PX wjGzMDMjFPHTid19zoQUVtlfd0odTEoIG7XnkO/siYINxMkBYFJ0m1hqw1IZpeqegovG 2cFN9i2PxHA4Q0O3vEKW8Lg2JUSPJthmqLkkKjISAAkURej/yyZKAswzopttm3/AojVw 9Q4cQbjb9m3G+ag1WbCyHaUcsl5g2jxjpFXXtb9452RLMDax3oPoA5XcnklM/ejQm7Ax HYSSEHLRMXNOERv2mjuu/Q8YHeCPRWnLnLkCERsNhbRSbM/es0tvQE7fEmfbnSdwLJbS HkRw== 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: AGRZ1gL89LKKuDtPnsmDWoofvyS8dED323F+50ZbyGsDgDzCQJ+s+jyD slFjLuxBSPGAa+9kfoZT8z7/UhHFQL9WlnUuYQoAWBl3kK9hA9Ee+L+AO9xNN5xY9mYQSfkpOsc 9AVVyW+geG5nBqUdIdkbnCWNwK3qnTF8qZupPyQ4OFrLNs7/764NeD6vU/29CEPyeNA== X-Received: by 2002:ac8:1e84:: with SMTP id c4mr20499010qtm.181.1542622636393; Mon, 19 Nov 2018 02:17:16 -0800 (PST) X-Google-Smtp-Source: AJdET5cuUCyxSDa3gWbiC+05vYdwh0VTJJerr2vfIIWvoU+AihJFrguPYesmXHta666UX5DPDxim X-Received: by 2002:ac8:1e84:: with SMTP id c4mr20498973qtm.181.1542622635680; Mon, 19 Nov 2018 02:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622635; cv=none; d=google.com; s=arc-20160816; b=WtAkyPza79lijivVywQV1BKBf+RPcKyc0Y7J5AEC+lU5c+zW+gSvJS15tu0+atkDLa X1ze6sYzgba7RgLKm66Enm56+0F5AdCjBylCcW0Cv3lXh2yx60LtTw1DjjQcV/pPzOS0 PmLpCtS8unGOmXps/xm4443VDwEwLb8s4DB5ueM1+udpdX/Eyy04DbYAuu9/CMBeevVy +dGBBCIGHxdTNMVT8f0+0GN7E9gFOxUbMWGyPRzTC3SNR9ERVitSGvHjRA6A5FUt2NQh CBB9qURIURwsviMFl6mAs/mHI2cIrGxiadBJUBw843YbsFBx37VV/YLzGQqOxH4pVxRC dZYQ== 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=atUER95Er8vxVyyJe2WQJsrmwnJCko1YRxZJ2dnB2Zs=; b=bu0HN2RFn9ishWIo6JKXHeB0AYGm5Y/fxFREVlbMAd/qTjnSBMq8SyQ7iguUZg0VjC dOJi78ViIz6ze30VVVM33tcJlRkdETR/0+wBYKYKwPhkfW34jht8/5TP/21xp9KhKy9e +C1p2hJpXi3b/oLEsKl1XDWMrvkfmxzxVmL7WGCxSWS01T28graYzgcM2nz3Ls56DP0i 3j+0Wf9Snj5GtFW0tpeLO+8p3ZcCB1DnaCZj0ViGZPzz7u9nyB97wXEiVIB4Q8vYe/IW GKIsT8JDwIsirhaNyfqFxk6Sf2Q5sWCJjAwuXuA/awiscdapywQnAYW2KEv5LxgrDM1r 1erw== 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 f9si2302847qtq.274.2018.11.19.02.17.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:17:15 -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 C2AE6C049581; Mon, 19 Nov 2018 10:17:14 +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 968D2105706D; Mon, 19 Nov 2018 10:17:08 +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 v1 7/8] PM / Hibernate: use pfn_to_online_page() Date: Mon, 19 Nov 2018 11:16:15 +0100 Message-Id: <20181119101616.8901-8-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.31]); Mon, 19 Nov 2018 10:17:15 +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 Signed-off-by: David Hildenbrand Acked-by: Michal Hocko Acked-by: Rafael J. Wysocki --- 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)); From patchwork Mon Nov 19 10:16:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688395 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 710EE13AD for ; Mon, 19 Nov 2018 10:17:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BB4F29B89 for ; Mon, 19 Nov 2018 10:17:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FAB829C25; Mon, 19 Nov 2018 10:17: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 DAC6F29B89 for ; Mon, 19 Nov 2018 10:17:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0C746B1A41; Mon, 19 Nov 2018 05:17:24 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B96D16B1A42; Mon, 19 Nov 2018 05:17: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 A5CB36B1A43; Mon, 19 Nov 2018 05:17:24 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id 76DF86B1A41 for ; Mon, 19 Nov 2018 05:17:24 -0500 (EST) Received: by mail-qk1-f199.google.com with SMTP id 80so68595447qkd.0 for ; Mon, 19 Nov 2018 02:17: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=uHWO9jQ0jVzDi3yMJpemvnTc99QXepZ+Jaaf6/1UIes=; b=W6po9/hACS/s/XMYcRVcTGZSdorsBal/hhFOfCmhttcBBzdReAw+PWKOGgN5Nsb7/p bcF9rGpcDPfhUH15Gz22Ca31I8dw2KINQT513d7TzuZAzTzTPiqA5dHbbGiDhbV1eKMB csVGF8FMKjUe5CxzDbHjxD3urMqiLv7OWVugwkhXG34QEA3yoMaUDU2rAWx+nFp34hFd yAiYPlia10tts9PFDQGo9FFgzx6YA00vc1CquXA2ectU/boOPvIcn/hkPTwJGPj9jAVE +QbrsSQMAAhwaxgAGCQi58DVsfXVIXLTKnx9KyRxQLkyz16zkjOcw6/02ERCfmn5IlvZ L5fQ== 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: AGRZ1gJCu2IlyL3P//ueKUpSXwaOucgIoF0BgpBUYfq+OEhhhp+PHn23 f6Qfz++JjoTFqj0oIopKD8A/Qmd9qoNcrPY/ixnIAqCQywySPWTJkxbR8mBvamca+BInJX5HdZc 0dcAXJHJBnoZd32cbu4MTWKeyr2F8G5wzXE2vxFmHLKv+ADwvea/UiWdERjM1KfuleQ== X-Received: by 2002:ac8:32b2:: with SMTP id z47mr20043825qta.209.1542622644245; Mon, 19 Nov 2018 02:17:24 -0800 (PST) X-Google-Smtp-Source: AJdET5dLFvkKNVk3/+CQvDyxD9hnB+ZEOyBD8Fhh3ArUc+oFMg7OrtqOWPtH9L4w6arzP0/1jP/q X-Received: by 2002:ac8:32b2:: with SMTP id z47mr20043793qta.209.1542622643480; Mon, 19 Nov 2018 02:17:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622643; cv=none; d=google.com; s=arc-20160816; b=ydbG04HpObbfWBm+Dq7p/jnpUKLB9QzBUhP89LCmhza6m9DNaXayHgZ12LLZYKGwD6 Z9aaQrmKkyoTuCxJ/xfCeELgjsm8r/EEhRxpf4gSxPxQeF2XZRZGvZ0c0jLtbBtqk8Mm nOiIxO/CDrZLtZzDKBNW9FtCN/n9FEk0PG0RkFYIbKSu1/xc7GGWJ57/FuL6tKGtjHUm lVGXzOVs+GA0zUv4Yx3T9CGjjQKBeZnBLWO1i6LTlWMVT9NrLcdsmpsXp+3I3filJXgZ mxRX/xeqZcNi+BWpaj5yG86L/PCYMGttJ7UF60D7GUbg3iJUR0WVAKBVSVUTZvcuuTxn BGdQ== 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=uHWO9jQ0jVzDi3yMJpemvnTc99QXepZ+Jaaf6/1UIes=; b=Yp/XzwZTlPkHd+BBAo0/7KdJdT4i+HyUgVhtbGTIwvLHxdmU5tj67Ts76mDxAjj+30 bnXfns6IFg+x+ZA24lz18SNzO/NAiau8dd7pxGXySokIDmx0c8hihKylUjEoo+iJGV3r qITrTf2RADMaJ1nIsMRwCN34MfUJEB1p9m1liHPTSEm7jN65hwdDCKnNqmZ2WK9QanYt VBR+6CFDJ/GSI9we+JGYHe1PyzIf+pvKaWhHThbzOEZvrd/UFIEP/JD80Jv3Ch9o/yty WUpwjLm4yIe/WllVsvspqxPxi8TG58Qx1JQdBuqE3LHJ0nyKg6JdCvYvB4uKtmzSOKLy TDMQ== 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 g92si2124389qva.34.2018.11.19.02.17.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:17: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-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 8F26A307D842; Mon, 19 Nov 2018 10:17:22 +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 1E6B8105706D; Mon, 19 Nov 2018 10:17:14 +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 v1 8/8] PM / Hibernate: exclude all PageOffline() pages Date: Mon, 19 Nov 2018 11:16:16 +0100 Message-Id: <20181119101616.8901-9-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.48]); Mon, 19 Nov 2018 10:17:22 +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 The content of pages that are marked PG_offline is not of interest (e.g. inflated by a balloon driver), let's skip these pages. Cc: "Rafael J. Wysocki" Cc: Pavel Machek Cc: Len Brown Cc: Andrew Morton Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Acked-by: Pavel Machek Signed-off-by: David Hildenbrand Acked-by: Rafael J. Wysocki --- kernel/power/snapshot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 87e6dd57819f..8d7b4d458842 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1222,7 +1222,7 @@ static struct page *saveable_highmem_page(struct zone *zone, unsigned long pfn) BUG_ON(!PageHighMem(page)); if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page) || - PageReserved(page)) + PageReserved(page) || PageOffline(page)) return NULL; if (page_is_guard(page)) @@ -1286,6 +1286,9 @@ static struct page *saveable_page(struct zone *zone, unsigned long pfn) if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) return NULL; + if (PageOffline(page)) + return NULL; + if (PageReserved(page) && (!kernel_page_present(page) || pfn_is_nosave(pfn))) return NULL;