Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2643076imu; Mon, 19 Nov 2018 03:57:49 -0800 (PST) X-Google-Smtp-Source: AJdET5eVLIWMrkrovY/uED8nUBJVBCksLpATsoH70Et6T7Clm8C8evjXWJKA6DvGevTAfVFT5aLa X-Received: by 2002:a17:902:bd46:: with SMTP id b6mr21948995plx.231.1542628669808; Mon, 19 Nov 2018 03:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542628669; cv=none; d=google.com; s=arc-20160816; b=snDUuNnoIVyk7Cyqpmr46ZxmR9vwtBhnfp8Nih6y3+rnurjaL6+pj79SQjxQUMy3OF GBvJod4xGHpKdteZfEHI3b20b36L5wj8l+tYqU/aI9LQR1BDEmSynSsckY+U8+bhCg5D fnXZ6cWyqUSZGabPbEel/AsX4uPfJ5Y2Af+1LOn/AW/Nq6Tz9+06KyRzUI/WAfNcoJhv VRLx1ko4qpcgEIv1p4Qbvn2A7+OcMYTcZ5qieMK9i3nmzwbNchZxW8PkjDMs7j5d1r8w jecISY9rYZTdrd6vg/waaOs68fY2gO0ss0wICltdNfdfCLIPSp9jcKqXGLLRHSErmPV2 4/0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ya+qz6ydXkNgMZKhYTQwRiwTRirHJxidJLua0Qn10Ug=; b=y20O3T3xiwU89m656XIKsK1grO90vCfAcSA8Oj2kWBDngUsS3A/NzZFZ1aJ5YWCM+J x00wvyUjTYSN/BYfQHXVv9cNpRiTmfyRiaFIfxKYCUhXeftSDglV5sHTl+gJnMk0qcUd j0svD5q8A93W6EWuLit4DRCoIpXUtO2lg3D6sjFTuXrF2uO4a/9VKppWyrPlMBKC7k+k lloMA3dmJrBA4GBU+1BDBG1fdzhJ7AzHJc7qWh1Q4odPZkPBEnecCUARwR/yo5tJlvh/ S69Wg4Uu9Zatg0qNTPRvEShxzWVN9z9q4m40FsU92fVRPfcSJ5iIZatp3+uTMSK8ti6X 708w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UHK6NlL1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v61-v6si9928139plb.191.2018.11.19.03.57.21; Mon, 19 Nov 2018 03:57:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UHK6NlL1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728660AbeKSWTo (ORCPT + 99 others); Mon, 19 Nov 2018 17:19:44 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:34663 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728554AbeKSWTo (ORCPT ); Mon, 19 Nov 2018 17:19:44 -0500 Received: by mail-it1-f193.google.com with SMTP id x124so7193519itd.1; Mon, 19 Nov 2018 03:56:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ya+qz6ydXkNgMZKhYTQwRiwTRirHJxidJLua0Qn10Ug=; b=UHK6NlL12MH9s/Dn7SeW7Jefk2NMdmGFVenYN/Au0fmchigg//3erhona0ru6I8mGj 8IVtezm9f9Z5RAVsqVK0wnhYIS4testOnFxCteA2SgI/CuCNtPcxX19VQnmzL9wBLqgR rkvipX9jxHXgQIfIYQj3q+AQfjC9LJaW2PGcRmnvZyV887pbn/cRf6fXyh70IY+q81j0 rVNBnvXVD5xdnNHsJrdqIrMvW5Dsw7qAlskRoyfQ4cHm6RChUwhI0HDCR+VXP4xyjxjM CcCYuhj9sqiMvasWcQYaZpTQcBmQ0ioMoxC7FryRje9UQYeqACClx1ugsGvVQplHfDzR nxog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ya+qz6ydXkNgMZKhYTQwRiwTRirHJxidJLua0Qn10Ug=; b=pCH55n0vpY4+YEGi2Po3nZewc3Da3upb1WULm1WNLIHK0508QlmWopBXIUoyNluDdA MXUIcOszfG2CfwKgCU/SPcESy6AfqjInX+IqH1wR2zYHxkErI9LdEqZ9PDGQB3W4Wu/w Zsc2Dbn4DqYTyY+7D77X+vqVJ6+onVaC3odgcXwx2tCx2i+6wy1ueXDZesaLtY4CvHsR 5LmhcWao/Xjto88mM3729zVrytecXxYOZ2An9+W+YhbSmawdhee3NUIf6JC+wCybleC/ Gx+K8V1VotY8UJD3B9nPyNeKClamjy2fk8kcozQfPvPEmxMcsY41V5J44G1SqeR0N6o7 DSnQ== X-Gm-Message-State: AA+aEWbtJKkJRhDs1UBmWHTJA9/sYRxCgRh2i/EqhX338s2yRfjcsfxh eqBDWnBNUkpcrcqvzpFMN9ANkZBDYUr2gvjxZAg= X-Received: by 2002:a24:6192:: with SMTP id s140mr3585933itc.97.1542628578908; Mon, 19 Nov 2018 03:56:18 -0800 (PST) MIME-Version: 1.0 References: <20181119101616.8901-1-david@redhat.com> <20181119101616.8901-3-david@redhat.com> In-Reply-To: <20181119101616.8901-3-david@redhat.com> From: Konstantin Khlebnikov Date: Mon, 19 Nov 2018 14:56:07 +0300 Message-ID: Subject: Re: [PATCH v1 2/8] mm: convert PG_balloon to PG_offline To: david@redhat.com Cc: linux-mm@kvack.org, Linux Kernel Mailing List , linux-doc@vger.kernel.org, devel@linuxdriverproject.org, linux-fsdevel , linux-pm@vger.kernel.org, xen-devel@lists.xenproject.org, kexec@lists.infradead.org, pv-drivers@vmware.com, Jonathan Corbet , Alexey Dobriyan , rppt@linux.vnet.ibm.com, Andrew Morton , chansen3@cisco.com, Vlastimil Babka , "Kirill A. Shutemov" , Stephen Rothwell , Matthew Wilcox , "Michael S. Tsirkin" , Michal Hocko , pasha.tatashin@oracle.com, alexander.h.duyck@linux.intel.com, Naoya Horiguchi , miles.chen@mediatek.com, David Rientjes , k-hagio@ab.jp.nec.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 19, 2018 at 1:16 PM David Hildenbrand wrote: > > 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. Ok, makes sense. Acked-by: Konstantin Khlebnikov > > 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 > --- > 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", Even 'o' keyword is better suits for Offline than for ballOon =) > [KPF_PGTABLE] = "g:pgtable", > [KPF_ZERO_PAGE] = "z:zero_page", > [KPF_IDLE] = "i:idle_page", > -- > 2.17.2 >