mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: david@redhat.com
Cc: mhocko@kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, vbabka@suse.cz, pasha.tatashin@soleen.com,
	Oscar Salvador <osalvador@suse.de>
Subject: [RFC PATCH 2/3] mm: Introduce a new Vmemmap page-type
Date: Thu, 22 Oct 2020 14:58:34 +0200	[thread overview]
Message-ID: <20201022125835.26396-3-osalvador@suse.de> (raw)
In-Reply-To: <20201022125835.26396-1-osalvador@suse.de>

This patch introduces a new Vmemmap page-type so we can better
picture and handle those kind of pages.

Signed-off-by: Oscar Salvador <osalvador@suse.de>
---
 include/linux/mm.h         | 6 ++++++
 include/linux/mm_types.h   | 5 +++++
 include/linux/page-flags.h | 6 ++++++
 3 files changed, 17 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index ef360fe70aaf..48845f054136 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3126,6 +3126,12 @@ static inline bool debug_guardpage_enabled(void) { return false; }
 static inline bool page_is_guard(struct page *page) { return false; }
 #endif /* CONFIG_DEBUG_PAGEALLOC */
 
+static __always_inline unsigned long vmemmap_nr_pages(struct page *page)
+{
+	struct page *head = (struct page *)page->vmemmap_head;
+	return head->vmemmap_pages - (page - head);
+}
+
 #if MAX_NUMNODES > 1
 void __init setup_nr_node_ids(void);
 #else
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index ae891c0c55fc..0bb8de4262c3 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -171,6 +171,11 @@ struct page {
 			 * pmem backed DAX files are mapped.
 			 */
 		};
+		struct {	/* Vmemmap pages */
+			unsigned long vmemmap_head;
+			unsigned long vmemmap_sections; /* Number of sections */
+			unsigned long vmemmap_pages;    /* Number of pages */
+		};
 
 		/** @rcu_head: You can use this to free a page by RCU. */
 		struct rcu_head rcu_head;
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 4f6ba9379112..2bad207515fa 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -718,6 +718,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)
@@ -784,6 +785,11 @@ PAGE_TYPE_OPS(Table, table)
  */
 PAGE_TYPE_OPS(Guard, guard)
 
+/*
+ * Vmemmap pages (see include/linux/memory_hotplug.h).
+ */
+PAGE_TYPE_OPS(Vmemmap, vmemmap)
+
 extern bool is_free_buddy_page(struct page *page);
 
 __PAGEFLAG(Isolated, isolated, PF_ANY);
-- 
2.26.2


  parent reply	other threads:[~2020-10-22 12:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 12:58 [RFC PATCH 0/3] Allocate memmap from hotadded memory (per device) Oscar Salvador
2020-10-22 12:58 ` [RFC PATCH 1/3] mm,memory_hotplug: Introduce MHP_MEMMAP_ON_MEMORY Oscar Salvador
2020-10-22 13:04   ` David Hildenbrand
2020-10-22 12:58 ` Oscar Salvador [this message]
2020-11-20 11:20   ` [RFC PATCH 2/3] mm: Introduce a new Vmemmap page-type David Hildenbrand
2020-10-22 12:58 ` [RFC PATCH 3/3] mm,memory_hotplug: Allocate memmap from the added memory range Oscar Salvador
2020-11-17 15:38   ` David Hildenbrand
2020-11-19 10:48     ` Oscar Salvador
2020-11-20  9:31       ` David Hildenbrand
2020-10-22 13:01 ` [RFC PATCH 0/3] Allocate memmap from hotadded memory (per device) David Hildenbrand
2020-10-27 15:40   ` Oscar Salvador
2020-10-27 15:44     ` David Hildenbrand
2020-10-27 15:58       ` Oscar Salvador
2020-10-28 18:47         ` Mike Kravetz
2020-10-29  7:49           ` David Hildenbrand

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=20201022125835.26396-3-osalvador@suse.de \
    --to=osalvador@suse.de \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=vbabka@suse.cz \
    /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

all inboxes | Powered by JetHome®