From patchwork Thu Nov 22 10:06:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693799 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 2AEB15A4 for ; Thu, 22 Nov 2018 10:06:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E04E2BA1E for ; Thu, 22 Nov 2018 10:06:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 124AD2BB0D; Thu, 22 Nov 2018 10:06:45 +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 94C692BA1E for ; Thu, 22 Nov 2018 10:06:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AC396B2AF1; Thu, 22 Nov 2018 05:06:43 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 609F86B2AF2; Thu, 22 Nov 2018 05:06:43 -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 40E436B2AF3; Thu, 22 Nov 2018 05:06:43 -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 0EF9A6B2AF1 for ; Thu, 22 Nov 2018 05:06:43 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id 80so8993683qkd.0 for ; Thu, 22 Nov 2018 02:06:43 -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=Kd7IBInTJuE5UyuhiTUmlbkfVgxPmpI0fHwb4kJFqF0=; b=jxo3dTfPTjcyr0qs4doqtbD2QMq3D0dCEXwwqTjph5K7GUPsTwe2N4AkXq8pEBOEUx D/HtfvzWgm6kbiPqWm/y8Y4n83WMqVeD6w9FHUtXMuThGVAdpvxKMZ+cdAveI4+uVPyZ E1LZVS5dBiYjXjl/RC34cCbosiKvHaq9E1dKsNb7d3Hoz+uWAW1iLVZuczpYedMa0Nkh L6/uXHFRpVmtlHI9XKrugDPlT3P9JCwhN2nAUp7ekRL0mqW9U79HqKtu1CoPk7w0JH3p rAQyxkYTMUvsR73aq7L70VMJ5n9fk+o5v36NCySqnL7p3JQhhWkQPcU6WKSgVyY/deua SY4w== 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: AA+aEWZBO9vnalRi94lBLNE87YSruErw8Qr7nKvouGY0RHzwDpb8ZGxS 4d1GMsWxFnNZw4jFIzH0HBbkL2sJvU7zznEk1xQcsbtcn/d5H374iDWs0ezt+I8vsdk4JrzDX9e DSq91KchddMCS0PyQg7DerrBVEYCZpkAm8qUfrbsCGynbl8bU8PDNcNPaZvQmuq0vgg== X-Received: by 2002:a37:a0d5:: with SMTP id j204mr8925379qke.261.1542881202824; Thu, 22 Nov 2018 02:06:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/W0MPQ5nXt++DF/VBl8p2yiw/DkL4DR2/hEGvLGgH2xanNM+OK7bX8v9dYX191Pi0BfY/ct X-Received: by 2002:a37:a0d5:: with SMTP id j204mr8925346qke.261.1542881202139; Thu, 22 Nov 2018 02:06:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881202; cv=none; d=google.com; s=arc-20160816; b=LDvJ3wqRR8KV2kPCd9Cl+DxdHbYw1WtEkgUJXWMv4Lc+1Fv4T+dkLtK6hE0jnjG0Tq 6YiGvAtppGEOstErgnS4ge4UApacY3/Kq+iuM7eMmwf0nxl/BVeYix2W64Lh20MM4UBU b3yrYtS5WMxQi0/4yWUn5isfyHMxI9/4DMX0rOafi6SIeFJ4LzeCpwhLtZ/AYATMH491 gdgAk6SlsapsHluRrQxtUXb9O8MCLxkPlJT/zmA/ckU65HHD5bgmhVVVH7q2gZHRrqHT O7cpD4H6utL/nGSqPOM/bS3hdHDYYpEuySdyYd2Y8jeAvikK/PpT870M+dWWRpSzdN16 z+tw== 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=Kd7IBInTJuE5UyuhiTUmlbkfVgxPmpI0fHwb4kJFqF0=; b=IQMWEdi+mb1hN1Yk/Ctxspige5qR+Y5wll+Y/SwM9M8UD54jO7bA/IZH6Vtdvl+6sg 8dwkfYGilB+BvBGFVaQRAaqehg21LnqbUPAILxv37BVAqBg8dkKduW2nSVCowPyhFthP Rdakw2RiIIpfSpzUaQYnny1/w/stC+6eVvWIYBzya3wg7UHtguNAdYcRYzpiAoIV+7DX zhzhQxY6NB8AY0bfBBALpzQmxfE1XltaL/hKL6zyy8UUkKVCctfA7Yyg+9beKrLY/plc PIMvgbvgrYihD3J9ksUgWYkAHqCCr5t4e2dr4X3c3Df7DAYSKKDxXZfjMFPL1ONxCIH6 tNxQ== 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 n32si2080435qtd.130.2018.11.22.02.06.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:06:42 -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 3286D81F10; Thu, 22 Nov 2018 10:06:41 +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 1A09E16BE8; Thu, 22 Nov 2018 10:06: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 , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v2 1/8] mm: balloon: update comment about isolation/migration/compaction Date: Thu, 22 Nov 2018 11:06:20 +0100 Message-Id: <20181122100627.5189-2-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.25]); Thu, 22 Nov 2018 10:06:41 +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" Acked-by: Michael S. Tsirkin Signed-off-by: David Hildenbrand --- 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 Thu Nov 22 10:06:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693803 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 8B42D13AD for ; Thu, 22 Nov 2018 10:06:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 756712BA1E for ; Thu, 22 Nov 2018 10:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 653FF2BAB3; Thu, 22 Nov 2018 10:06:52 +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 D2D8D2BA1E for ; Thu, 22 Nov 2018 10:06:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C960D6B2AF4; Thu, 22 Nov 2018 05:06:49 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C1FC26B2AF5; Thu, 22 Nov 2018 05:06:49 -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 A9A0A6B2AF6; Thu, 22 Nov 2018 05:06:49 -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 7A8B26B2AF4 for ; Thu, 22 Nov 2018 05:06:49 -0500 (EST) Received: by mail-qt1-f198.google.com with SMTP id z6so5773285qtj.21 for ; Thu, 22 Nov 2018 02:06:49 -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=EoiE/nRdRYJvmmn4yozXZMqOisU3xz6enNnh73HGQ3U=; b=gWu6K09UcFwqEDtygtvKrMRwAjrhEcmjtnOtEQRjCgtCL3wyoNb5FLm++UnW1OScsm 21BFFYRcLlW/HTtZMwXD0EOQWE+xlSK7+AIljVSlhkO4CBsnhIoS2qrls2OMUHu6xJdC mrLrD3WefTPZJZuOFpR4fPnC8CqxXX/fscf+xFRj39WlQd7tPlwKv1/UW7YIEL6MENld Nks/94qzMUW47h4slGSP+4yClgJB7Fi/I+4a6uS/9ZVTOI75CoANzi7Ox2d4rvJSttDU rTnTeZj7KO7YvL55HXVRQcQkrECVn4gmIOTGBwNHtV5bmVSUBqgqZk+yNZbsM8NhLRfh 6rzQ== 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: AA+aEWaC4fgzZuVEnae2YtSOIl202qtVlnvBB7tA1MdG6XsqiSgF+33n 1RiAltUYXkXOQ/+6On8+7mcvf1DhqKld+EE0WhfmFLaW6O/d/0aG44JqM3I86/YQhNKllbQgPPL WuZXhNYeXCIdKbud3HMTDjZLZHUqTA+19DMtDwouOykeh8WA1Hn3bRry9gHR+Yh+aWw== X-Received: by 2002:a37:1fc8:: with SMTP id n69mr9055248qkh.175.1542881209144; Thu, 22 Nov 2018 02:06:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/WxHuD2LPZWKOuHW8T8rjQpvzHPktM3BFrS1f/j2soJCfai8cd+tjKlYVs6kKnpzbFaXFNv X-Received: by 2002:a37:1fc8:: with SMTP id n69mr9055186qkh.175.1542881207942; Thu, 22 Nov 2018 02:06:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881207; cv=none; d=google.com; s=arc-20160816; b=LNFLGl0xR30BUz/IGdDEbmt61PODBVLRQ29Il5fkAlLzMs+UAyFfr9YW4T3mxM6oep pWsVW5B49Swx1aVSTiaR9zz6a8ZhjQTJXBi1OqmSOEM/+jDRnxtnXbkYredCqJxZL8OV bqAhigYHyrS0L4nX7s42Cl8WqGSvS4NNZ0nfGofuTFQjOndb6tisrrABzewwXO5x6Epk fJ0lv2pOpTnR5oK6GmdZyiX25cLD8yyriNWm9vTPyOHuLdI4rl2STQdMFRmVmJxXcxCT N0JFp8rV20F4j1OtHQ7kEgVWNUI8eUMpCIsVLqJIxKajCqhePG4rzwdwB+kIhosXc3/x Tr1A== 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=EoiE/nRdRYJvmmn4yozXZMqOisU3xz6enNnh73HGQ3U=; b=mnkmNpol4DQDJajpmP03Dq3eG7TTZi7v1DOTEh3KduFiRijWzRRli0I1LDPeSfVRuO OIsGH5ddxkW6epmsWKCoxyKeZz8uaVOSS5LDZdNrXQRA3t6AL2zALapFRUfzfFnlz/Os 6jEpuoFk8bew0wK3aaEEsC+IwceZ5GFfCX8bBT2WJMJ3CP+H3qwUlK5WNGD/tz97S3JX qNtMn4+vTDE/F3Wvyp+Ule4RJ62bX/Pks+mTt2v1skZqmpZCeAEeHkgIivsROX+4RCQ5 4GuYGWIKzyB9uIH3izq9nEcEVXcLxED44/vkzuu/5EGoCp1cj0t9ztILOtYnhnkNl0U7 69yw== 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 b54si6058956qvb.176.2018.11.22.02.06.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:06:47 -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 BD6973002887; Thu, 22 Nov 2018 10:06:46 +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 7F3BF57B0; Thu, 22 Nov 2018 10:06:41 +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 v2 2/8] mm: convert PG_balloon to PG_offline Date: Thu, 22 Nov 2018 11:06:21 +0100 Message-Id: <20181122100627.5189-3-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.43]); Thu, 22 Nov 2018 10:06:47 +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 Acked-by: Konstantin Khlebnikov Acked-by: Michael S. Tsirkin Acked-by: Pankaj gupta Signed-off-by: David Hildenbrand --- 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..b70e5dae13d4 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 page 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 Thu Nov 22 10:06:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693809 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 561065A4 for ; Thu, 22 Nov 2018 10:07:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 461A62BA1E for ; Thu, 22 Nov 2018 10:07:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3983F2BAB3; Thu, 22 Nov 2018 10:07:05 +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 B56A82BA1E for ; Thu, 22 Nov 2018 10:07:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D9326B2AF8; Thu, 22 Nov 2018 05:07:02 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 95F0B6B2AF9; Thu, 22 Nov 2018 05:07:02 -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 7FFB66B2AFA; Thu, 22 Nov 2018 05:07:02 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by kanga.kvack.org (Postfix) with ESMTP id 521366B2AF8 for ; Thu, 22 Nov 2018 05:07:02 -0500 (EST) Received: by mail-qt1-f199.google.com with SMTP id n45so5836990qta.5 for ; Thu, 22 Nov 2018 02:07:02 -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=7DE3NTyk2KqSazwc3TnGw+eY02xeO39mwh3PA4exfno=; b=Z24AT1QVhRcSaatbPkZXvBSUDACoe0uYGJgIcTa688CsAyNAuZ1sTWTVurIJ3jxiLB JfIibmkUsvCYlTxJZulYCujMSURll2e5q9jYBATaU8cGZ5OgcI9l7h9fzg+zJRfmHIWr aJS8KKuxw2pOEdBhdQYm8FdlzmBgmtWUxvQ/7NiClDg6YtHyXEA4cp5QXvC16DH6ZYqV wZTKXSV00nHOEcwOZcmB/ncgnp+2VufaK9Vf8auJQhbcMZ76jUbVklbajUDV7Y8fhX+Z 2MOJMpzX4bzKR18xcalG9Ls3wC0DTkuu4Sabxp7KrtK+3TgocBS9riowdZWnbCHelBzY SewQ== 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: AA+aEWZM3cCHe/ALJwmrjwedqGBij5OF8HOApxbEmBwY1kpuxHIcP/yf MrNITfE4T+3Vz00pdXp7xzRaJfXsn3kETgEwnLO52gm17+EFDoPWAoW6YTLKm+LsBX3Trowymdy 2zRveqBgPkRTRL8ZHqJC1s4c/gj5AYjhwmSgaeSxaOXPl2mHMdlCRUFcddkT4MrOqHg== X-Received: by 2002:a0c:b48d:: with SMTP id c13mr9366441qve.91.1542881222076; Thu, 22 Nov 2018 02:07:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/UD0zXGbvOiUUIV7ilokMZJD2E7RyrDj+SsqVP88SC1GvpwIcobixJuiXplIdu85X18Dp45 X-Received: by 2002:a0c:b48d:: with SMTP id c13mr9366387qve.91.1542881220939; Thu, 22 Nov 2018 02:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881220; cv=none; d=google.com; s=arc-20160816; b=RnZbJyW5OJv5d1IkvFpJbtfYnmKL/yB29+oNKC9sHO3pPnrteL9opWHbxQE5l+6bFJ Wa8KgZGzXURP7dklQWkXyYathnWdIXiLvT0/2nlTXpnvYvifdXNMz4UjVBRU2KQrwYBv PSKMwV04EO8ZBy3R253hcCO3KFKUMOhGvA2xwdjUzIdP9/GAz94fG5gKU7pLOmk1Zsa0 vCNIZtfODhdm7rQLQR4WVbwofhjeKWh40t5T+jk0glfcZ/MLnRjiqFiAe5eRRhf6FiJE tLc2t66RWg5rhKFemVS4W5Z8O7qR5QmRzOfkE6pbWSiHdeRe2JHKeCdLA6WKh3fkYUTg RCPQ== 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=7DE3NTyk2KqSazwc3TnGw+eY02xeO39mwh3PA4exfno=; b=N4XYrCGtboUk8puoOQITTc0XJeUf4sG8aJDMk6veI1Y2sP8MHjnSFXpQnliDNcynw9 f58ZGoO9raU+FlX17jXasuQq5jlcVBa75/So7nAEYi6vmxoNZwB5o6ZhJsEl55h2o9fH Mov7DhBE/AvGaydKvAI322x22R6RLx6PTayYm+TXs/r1gCJmCf7g34Pb5F4KUccwJ15G CjxiK2ycyhUxfXHlTmUOLHWYBFgzBZYo9i8+9bb+9R11aPyUDP26zfpS/iNmG/vtKbUz 0c2NtzRuVNGUAI/tWTWuEwD8QwxQCoAZYBU4md6o5aLsELjmivHQnQ9UaWHXcAWpwVcz Srfw== 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 s74si2174243qks.195.2018.11.22.02.07.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:07:00 -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 E2CB0315487B; Thu, 22 Nov 2018 10:06:59 +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 1627C16BE8; Thu, 22 Nov 2018 10:06:46 +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 v2 3/8] kexec: export PG_offline to VMCOREINFO Date: Thu, 22 Nov 2018 11:06:22 +0100 Message-Id: <20181122100627.5189-4-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.41]); Thu, 22 Nov 2018 10:07:00 +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. (we export is as a macro to match how it is done for PG_buddy. This way it is clearer that this is not actually a flag but only a very specific mapcount value to represent page types). 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 Acked-by: Michael S. Tsirkin Acked-by: Dave Young Signed-off-by: David Hildenbrand --- 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 Thu Nov 22 10:06:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693817 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 360B313AD for ; Thu, 22 Nov 2018 10:07:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2548E2BA1E for ; Thu, 22 Nov 2018 10:07:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16B212BAB3; Thu, 22 Nov 2018 10:07: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 915152BA1E for ; Thu, 22 Nov 2018 10:07:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C7116B2AFA; Thu, 22 Nov 2018 05:07:10 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 84EFE6B2AFB; Thu, 22 Nov 2018 05:07: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 718396B2AFC; Thu, 22 Nov 2018 05:07:10 -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 432986B2AFA for ; Thu, 22 Nov 2018 05:07:10 -0500 (EST) Received: by mail-qk1-f198.google.com with SMTP id v74so8811381qkb.21 for ; Thu, 22 Nov 2018 02:07: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=Nxtv3n9rUX3Umq56CPsblAVXzZrf0zdjcbISE72CVEo=; b=UA6l3DzDadDMnwPbS9tEgX3L9W8fYEXH2beRMhqpa8qmH/TPg1x9fDXnMx9V2rxUTy TcL9Dy1Unp+We8kPbBnQFKor2aYjFd53KPAbNF/kDE1g/cuhUhwG+6GLwkL0Y+9H9YLJ Gb65Z0BfR2KHv+YDkL4bljwNXjm1fGfJDW2W809AqNK8qCp7BaM5cKM/M0F92d1MTYIy GnQdQTwPRovcqmDUZmnmRi+J+uNP+Sk3EALmTMKzz16O0CkhIcj/I41SZPbXjlRPj+9A Rns8H3jGOMwWSJF9Dfvyp0JsXHuFs2/b+TJWvls1p8mvfIOq8ZroWgOeXFfi0s1FeqQy C1dg== 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: AA+aEWb12QUgVl3XaXiznjyU5vP5x5g7EmmgbZKFyBNG4ZnYidNUC/eD 2vtDJHQM+jcolJskIISikBppvJmN+x9XkjA8gvKhrjwnpxAFlJEJ5bX6N7UeCo6a1TwLMMvImBH FrBBqgC0/hhNjg5YoiDQBP0DvWjxaqlF3hzT4F3b2VaOydqOKHMoQaQCwu7zlGvOuWQ== X-Received: by 2002:aed:29c7:: with SMTP id o65mr9398251qtd.353.1542881230057; Thu, 22 Nov 2018 02:07:10 -0800 (PST) X-Google-Smtp-Source: AJdET5fM3ygTT4lvnv8OBIPjHpXhb7O4AucXMcA1UMBunQZ2AKYxYXaga1AH4zEedvkv5CUIS7MC X-Received: by 2002:aed:29c7:: with SMTP id o65mr9398206qtd.353.1542881229291; Thu, 22 Nov 2018 02:07:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881229; cv=none; d=google.com; s=arc-20160816; b=M95zSITLHqSO+HFUC3MQBRowYcbEvVwWfX7MltFZ1L14nYZp/36KfpqeOZa/dEAOxC va3o5rHCenQG9plSw8UY1RluLOf2ECUCcvgBkpZ8/fPcZ+9yWHij/wh0niReS2Alxm6y 9BJJ8AE8USjNOCD/qxOiFCFPNZv0+W6Z5T32f1LaAUitaxGrPZGmnoy36xkhZ8jrhVzO DcQT/5GeaG/HG0aHfkVxlZNiZykNg4WoG/4HIA2V2WYXLRPh7916T6/mnvBOB3Ek+lFr OLFm2i/rhYwZRbu8muuS6CAVqWkflNnDxJVkyq+XjDo08NHeHC3QELxjChCFQ8Fn8oym ANtQ== 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=ggLeqO5zYlrkjcyxWO8S3YJ+012oZFYYy2Y/SksA74Q8qsLys6DEbAzY6Xc/qEW4go Z5Zv9SfADM3qg+cfIGvyKbgb0K/W0KWgzMa2DDHgkNNZgTQuiGu8AaID/hROhv3RVztt cyArjAhlTiDeqVlXj/ug9ROBIL+ZuuwcmOAv5zqX6A3e98XyQToyhdl6hwrZMgVMJhgI l5zncByY9nblt9r1NXmf+X2kzMasQlXmT8iiDES/Xtzx3h8k18Y406Ml/abIAFmW0W8Y GUo3fmpJ2ejKrRFtoypLYK69bA1tTIWeNcWU4aUI0Ji1A0Ikk8Af62uilcE1RPU8lrGC /+kw== 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 o61si5363344qte.74.2018.11.22.02.07.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:07: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-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 5B36DC04FF86; Thu, 22 Nov 2018 10:07:08 +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 3C32B16BE8; Thu, 22 Nov 2018 10:07:00 +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 v2 4/8] xen/balloon: mark inflated pages PG_offline Date: Thu, 22 Nov 2018 11:06:23 +0100 Message-Id: <20181122100627.5189-5-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.31]); Thu, 22 Nov 2018 10:07: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: 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 Reviewed-by: Juergen Gross --- 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 Thu Nov 22 10:06:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693821 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 2DD2013AD for ; Thu, 22 Nov 2018 10:07:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC7F2BA70 for ; Thu, 22 Nov 2018 10:07:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12ECA2BB0D; Thu, 22 Nov 2018 10:07:16 +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 A7E442BAB3 for ; Thu, 22 Nov 2018 10:07:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A9E36B2AFD; Thu, 22 Nov 2018 05:07:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 430126B2AFE; Thu, 22 Nov 2018 05:07:14 -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 2D1576B2AFF; Thu, 22 Nov 2018 05:07:14 -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 EFB7A6B2AFD for ; Thu, 22 Nov 2018 05:07:13 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id 92so8913668qkx.19 for ; Thu, 22 Nov 2018 02:07:13 -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=hXsuXdcEZ60G/VK2inNibYl/zfQ/d8rFfLdcw5yksuc=; b=TcexNtzwXI1RRylef72XJEdZl7pVbBZ7eDo7pFDr+Bd8dZvqtpZc1RrMbl9VqAo3c9 JFSbNht9ycqpV+1YJv+G/pInTxejUpxz/99P/0er2VfhD+TS5qmFMjym6OVqQzQ6EmBf sOo9jGib5J5f+CzxOYYOhBfKlSW4APRxCHMCUgjhpr3JQ2cQmbqh37FW6Eg4Y1L2weWh 89FTNkXQ0va2FTvS6I5w0ULnnVVCryZ3SvmJQJCejXohZTnSn5ie5JwluoRl03ruj99J BZtAiOOxq5scvpV0mMBu1X2Wjgu1wqsBpQL4r8USy4bw+B4vhA1FXPJ4w4RFmSDpZlgN 3JwQ== 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: AGRZ1gKUk0Nz4GK/z1pn9VBsvgromfoCVOnM6TWvHth/MRivGVkA5gQi vZtfe0SF843KbZubz1giOB79PN9bdRZP6WdwmMBhSTSqbePc0NmxuiXnQXCjEmVXbf4iuUAz7GO vxsRh2emeTYj/Lya2ciaF0s6IceuQ6AmMbG0QmD+30kFJcqLuNPGk7cqT/cZg0U8sYQ== X-Received: by 2002:ac8:43d0:: with SMTP id w16mr9404243qtn.78.1542881233759; Thu, 22 Nov 2018 02:07:13 -0800 (PST) X-Google-Smtp-Source: AJdET5fVzNcjo0cQ6eKsWU4ajKe7kU0bln0198KDVwAENVR2vwTH2c42H2ncJH9YgbASmGiX0cb0 X-Received: by 2002:ac8:43d0:: with SMTP id w16mr9404211qtn.78.1542881233182; Thu, 22 Nov 2018 02:07:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881233; cv=none; d=google.com; s=arc-20160816; b=1FCD7OCH2xnjWf5VCUR7ROVocJuLtX+DEIVfrKVNQDrVNglK+VA+YgRUuc8d8aAtLi 2U6/eiwh69y4YmFScTu4mCM8GU8cu907OUq1aRXKGaPi0UEmLRaxNFk6nhwQT7xFHvsq sSwJl3Tqy5S/pmWr5mpCaKjF6FlsH+Ze+WasMS4RwkyFfNUrTkahTndDySVgQnQ9DBIA eMqlVtIso0TWrfljFuynT97Zglbw7ToaLmJ02lSJldcw+ghm6ea9CRp/dM+rCmsUEYZ7 p6lUQpKn6IPoQCvBwSdzBYu6R8MpjrQ9TpeDApenEdNFDXWwFAy8ax7dzMG7FAmvIrU8 2mpA== 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=hXsuXdcEZ60G/VK2inNibYl/zfQ/d8rFfLdcw5yksuc=; b=gutXFoLXbKtH1YWFBrPZGmJsSkebTKHCsGNz19vviWqLwPvvWm1n7vVLnRnNmuT3/T 4b+XzclVNPEq0bWp90zsaREFaVu+yvltdDbQLPqt2aOcS3tEP8wNAQwVv2bg2hMJEwr5 6QIkOqKyhxVH1b4CVAuOz2s51i+QHQRhlakyySfzD8BUwtwm7WsheCmjnbj1/OxEO2W+ x5b3k1B3zrdWEKsTaiu+42yW5W/PuiL8tqzK+72wZ97N4eINjO5SSwz1ioyxYv201ZgY mkLOv5rEogfqxn7Z3tp5uexOAFQPfKrNbwuKR/o+950czK9DbJp2Dnp1w0d1wl7O2tGB bB0Q== 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 u16si9887277qku.262.2018.11.22.02.07.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:07:13 -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 2DBB446263; Thu, 22 Nov 2018 10:07:12 +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 A6DFA16BE8; Thu, 22 Nov 2018 10:07: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 , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Kairui Song , Vitaly Kuznetsov , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v2 5/8] hv_balloon: mark inflated pages PG_offline Date: Thu, 22 Nov 2018 11:06:24 +0100 Message-Id: <20181122100627.5189-6-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.29]); Thu, 22 Nov 2018 10:07:12 +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" Acked-by: Pankaj gupta Signed-off-by: David Hildenbrand --- 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 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)); } 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)); From patchwork Thu Nov 22 10:06:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10693835 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 E2D5613AD for ; Thu, 22 Nov 2018 10:07:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D17A42BA1E for ; Thu, 22 Nov 2018 10:07:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5A4D2BAB3; Thu, 22 Nov 2018 10:07:33 +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 469012BA1E for ; Thu, 22 Nov 2018 10:07:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36DA76B2B04; Thu, 22 Nov 2018 05:07:32 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 31D0A6B2B05; Thu, 22 Nov 2018 05:07:32 -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 1983E6B2B06; Thu, 22 Nov 2018 05:07:32 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by kanga.kvack.org (Postfix) with ESMTP id DF7646B2B04 for ; Thu, 22 Nov 2018 05:07:31 -0500 (EST) Received: by mail-qt1-f200.google.com with SMTP id w15so5840107qtk.19 for ; Thu, 22 Nov 2018 02:07:31 -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=eiWDEEk22vBkyyp8M3BvlsYM+ovUhtbTV2FeGMbkcp4=; b=gLQswh2gBZzUry4uxbR9ufH0oNCfLWgnAACqYQE4F4asde1jdNYes4EO1AuU2LyRaR eCYjBhHv5qP3YwV8NihEUQpv5gX8jk4AnGVpxX4ZiaczRc0cOmCGtr88f2HqMj4R0syt lMCZ6wUinkWDO0WOCvoZoqpgIWm4cSm6D0Ls240ZB4EHHhStXc/pJFISIvSHPBw8EFFP 7XS96+oFSdUlQ+frNT9AvribAe1R3a/Tw455ctsWRA/FfFyLFT/1bxuyAHTvPDK4w91w e9Q1Jn1GmjKBrQgqwEGc3a5xl5RkhfFkGXJdQmA9AR8XdozXLuc9GRD5Vh+10vuP2B8L Z8Og== 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: AA+aEWZMhW4FeJsrO9wif2qV3hLJSXu3j+eVrylJgSzEz+HmtJv5xQ69 Rpqv6PiRa9e/TtFM7c7yHdDvchbnp9Oi4kfckFYS8GwBI+UPKBvnDxbK0fWm+WEUsmP1xNmNM2E x2t5Mp+mY+N2p1dMTwUGdu6gu+n4gl5jqlJFO04VEgwjoSbtjNTX+1MG7Ae53+O1J7A== X-Received: by 2002:ac8:2b42:: with SMTP id 2mr9130398qtv.255.1542881251668; Thu, 22 Nov 2018 02:07:31 -0800 (PST) X-Google-Smtp-Source: AJdET5drAFI+PQSuDVFIHjF71G/wWgGFabIhdcxSBV23tvtkD5yfQAHycodI6dOrtzMCiV4yVSt2 X-Received: by 2002:ac8:2b42:: with SMTP id 2mr9130371qtv.255.1542881251081; Thu, 22 Nov 2018 02:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542881251; cv=none; d=google.com; s=arc-20160816; b=gXJffr1yKZOx4GibmTRDWGJ5m9UcUm6a4G++RfiOJu/qpN2iMwzOhXMiVqcq1BkiCQ rtR8W3UZWFNpBuYUEQW55aPGlrAN3kGxUYtOsZkxGM3V++rwd489geWY28bO4aAsJJqI QEnDiWohZlLiv90/6+O+vtdx4t5tjcY09our7SCZreRSGgp1+RCIAHR+L6o580bRBek8 XqEqcqXigE4Za2zo2jhtFcEj45AR88C92EBt73eCk0N1ygDtA7i6MapMVvBH/jicpbMw mJRtYe7+oqBCrra9bsmzrnc+QxTFYlCwUMFTPw30dCITNTXz3UOVNAPAe5oey9GhCG52 zaEw== 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=eiWDEEk22vBkyyp8M3BvlsYM+ovUhtbTV2FeGMbkcp4=; b=cJMxSGq3yB2yjTtJtSy3I7dFyHfg1kzr/WxnFwMRANczlKdhRSn3MMwGvNo9/ZZo2K BzECQskmBHSUuP6wKMtIR2qQQsuxhrmmxR6VrRLJ6ob88wPcmBpamfnJuZXkXUwk8NNj u3TvI9bALAQ16lLSA1leP7CojorOdSXjMwSjLjlhHdXQJhSYp2DKskD1KQ6mh5ZgzBfq Kk94o7bL1W8fRkkRrW+YYayna0STQXO1BTYNfK8/v5jW+pesLdx92XMNkkpzVMs+n06l z3Z6FRBBDbBiB1RIHRAFwg1hFs6iQ72Kn0nlDtiQGn/rcECb3GUumDNa4VjC54ctpvat Uwug== 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 o5si5751555qkh.112.2018.11.22.02.07.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 02:07:31 -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 21022306B661; Thu, 22 Nov 2018 10:07:30 +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 6D4D7282CD; Thu, 22 Nov 2018 10:07:23 +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 8/8] PM / Hibernate: exclude all PageOffline() pages Date: Thu, 22 Nov 2018 11:06:27 +0100 Message-Id: <20181122100627.5189-9-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.41]); Thu, 22 Nov 2018 10:07:30 +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. In saveable_highmem_page(), move the PageReserved() check to a new check along with the PageOffline() check to separate it from the swsusp checks. 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 Acked-by: Rafael J. Wysocki Signed-off-by: David Hildenbrand --- kernel/power/snapshot.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 87e6dd57819f..4802b039b89f 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1221,8 +1221,10 @@ 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)) + if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) + return NULL; + + if (PageReserved(page) || PageOffline(page)) return NULL; if (page_is_guard(page)) @@ -1286,6 +1288,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;