From: David Hildenbrand <david@redhat.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: Muchun Song <songmuchun@bytedance.com>,
corbet@lwn.net, akpm@linux-foundation.org, paulmck@kernel.org,
mike.kravetz@oracle.com, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
duanxiongchun@bytedance.com, smuchun@gmail.com
Subject: Re: [PATCH v2 2/2] mm: memory_hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP
Date: Thu, 16 Jun 2022 09:30:33 +0200 [thread overview]
Message-ID: <24d5ec20-9c9e-93aa-11f4-c4619f51f7d1@redhat.com> (raw)
In-Reply-To: <YqqqPjkh9r8ZrH0r@localhost.localdomain>
On 16.06.22 05:57, Oscar Salvador wrote:
> On Wed, Jun 15, 2022 at 11:51:49AM +0200, David Hildenbrand wrote:
>> An easier/future-proof approach might simply be flagging the vmemmap
>> pages as being special. We reuse page flags for that, which don't have
>> semantics yet (i.e., PG_reserved indicates a boot-time allocation via
>> memblock).
>
> The first versions of memmap_on_memory [1] introduced a new page type
> to represent such pages, not sure if that is what you mean, e.g:
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index f91cb8898ff0..75f302a532f9 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -708,6 +708,7 @@ PAGEFLAG_FALSE(DoubleMap)
> #define PG_kmemcg 0x00000200
> #define PG_table 0x00000400
> #define PG_guard 0x00000800
> +#define PG_vmemmap 0x00001000
>
> #define PageType(page, flag) \
> ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE)
> @@ -764,6 +765,24 @@ PAGE_TYPE_OPS(Table, table)
> */
> PAGE_TYPE_OPS(Guard, guard)
>
> +/*
> + * Vmemmap pages refers to those pages that are used to create the memmap
> + * array, and reside within the same memory range that was hotppluged, so
> + * they are self-hosted. (see include/linux/memory_hotplug.h)
> + */
> +PAGE_TYPE_OPS(Vmemmap, vmemmap)
> +static __always_inline void SetPageVmemmap(struct page *page)
> +{
> + __SetPageVmemmap(page);
> + __SetPageReserved(page);
> +}
> +
> +static __always_inline void ClearPageVmemmap(struct page *page)
> +{
> + __ClearPageVmemmap(page);
> + __ClearPageReserved(page);
> +}
>
> [1] https://patchwork.kernel.org/project/linux-mm/patch/20190725160207.19579-3-osalvador@suse.de/
IIRC, that was used to skip these patches on the offlining path before
we provided the ranges to offline_pages().
I'd not mess with PG_reserved, and give them a clearer name, to not
confuse them with other, ordinary, vmemmap pages that are not
self-hosted (maybe in the future we might want to flag all vmemmap pages
with a new type?).
I'd just try reusing the flag PG_owner_priv_1. And eventually, flag all
(v)memmap pages with a type PG_memmap. However, the latter would be
optional and might not be strictly required
So what think could make sense is
/* vmemmap pages that are self-hosted and cannot be optimized/freed. */
PG_vmemmap_self_hosted = PG_owner_priv_1,
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-06-16 7:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 2:55 [PATCH v2 0/2] make hugetlb_optimize_vmemmap compatible with memmap_on_memory Muchun Song
2022-05-20 2:55 ` [PATCH v2 1/2] mm: memory_hotplug: enumerate all supported section flags Muchun Song
2022-06-15 9:35 ` David Hildenbrand
2022-06-15 13:02 ` Muchun Song
2022-05-20 2:55 ` [PATCH v2 2/2] mm: memory_hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP Muchun Song
2022-06-15 9:51 ` David Hildenbrand
2022-06-16 2:45 ` Muchun Song
2022-06-16 7:21 ` David Hildenbrand
2022-06-16 10:16 ` Muchun Song
2022-06-16 3:57 ` Oscar Salvador
2022-06-16 7:30 ` David Hildenbrand [this message]
2022-06-17 5:46 ` Oscar Salvador
2022-06-17 7:28 ` Muchun Song
2022-06-17 7:39 ` David Hildenbrand
2022-06-17 9:10 ` Muchun Song
2022-06-17 9:25 ` David Hildenbrand
2022-06-17 9:40 ` Muchun Song
2022-06-17 9:48 ` Oscar Salvador
2022-06-17 7:43 ` David Hildenbrand
2022-06-17 9:54 ` Oscar Salvador
2022-06-17 10:14 ` David Hildenbrand
2022-06-17 10:49 ` Muchun Song
2022-06-17 11:19 ` Muchun Song
2022-06-18 5:49 ` Muchun Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=24d5ec20-9c9e-93aa-11f4-c4619f51f7d1@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=duanxiongchun@bytedance.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=osalvador@suse.de \
--cc=paulmck@kernel.org \
--cc=smuchun@gmail.com \
--cc=songmuchun@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).