From: Max Kellermann <max.kellermann@ionos.com>
To: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Cc: willy@infradead.org, sfr@canb.auug.org.au,
Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH v3 10/14] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h
Date: Tue, 5 Mar 2024 09:59:15 +0100 [thread overview]
Message-ID: <20240305085919.1601395-11-max.kellermann@ionos.com> (raw)
In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com>
This is needed to eliminate linux/skbuff.h's dependency on linux/mm.h.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
include/linux/mm.h | 28 +--------------------------
include/linux/mm/folio_zone.h | 36 +++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 27 deletions(-)
create mode 100644 include/linux/mm/folio_zone.h
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e8a914e7bebd..b3f83fb26aca 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -5,6 +5,7 @@
#include <linux/mm/folio_next.h>
#include <linux/mm/folio_size.h>
#include <linux/mm/folio_usage.h>
+#include <linux/mm/folio_zone.h>
#include <linux/mm/page_address.h>
#include <linux/mm/page_section.h>
#include <linux/errno.h>
@@ -1370,33 +1371,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags)
}
#endif
-/*
- * The identification function is mainly used by the buddy allocator for
- * determining if two pages could be buddies. We are not really identifying
- * the zone since we could be using the section number id if we do not have
- * node id available in page flags.
- * We only guarantee that it will return the same value for two combinable
- * pages in a zone.
- */
-static inline int page_zone_id(struct page *page)
-{
- return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
-}
-
-#ifdef NODE_NOT_IN_PAGE_FLAGS
-int page_to_nid(const struct page *page);
-#else
-static inline int page_to_nid(const struct page *page)
-{
- return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK;
-}
-#endif
-
-static inline int folio_nid(const struct folio *folio)
-{
- return page_to_nid(&folio->page);
-}
-
#ifdef CONFIG_NUMA_BALANCING
/* page access time bits needs to hold at least 4 seconds */
#define PAGE_ACCESS_TIME_MIN_BITS 12
diff --git a/include/linux/mm/folio_zone.h b/include/linux/mm/folio_zone.h
new file mode 100644
index 000000000000..572fe37068f1
--- /dev/null
+++ b/include/linux/mm/folio_zone.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_MM_FOLIO_ZONE_H
+#define _LINUX_MM_FOLIO_ZONE_H
+
+#include <linux/mm_types.h> // for struct page, struct folio
+#include <linux/mmzone.h> // for ZONEID_*, NODES_*
+#include <linux/page-flags.h> // for PF_POISONED_CHECK()
+
+/*
+ * The identification function is mainly used by the buddy allocator for
+ * determining if two pages could be buddies. We are not really identifying
+ * the zone since we could be using the section number id if we do not have
+ * node id available in page flags.
+ * We only guarantee that it will return the same value for two combinable
+ * pages in a zone.
+ */
+static inline int page_zone_id(struct page *page)
+{
+ return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
+}
+
+#ifdef NODE_NOT_IN_PAGE_FLAGS
+int page_to_nid(const struct page *page);
+#else
+static inline int page_to_nid(const struct page *page)
+{
+ return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK;
+}
+#endif
+
+static inline int folio_nid(const struct folio *folio)
+{
+ return page_to_nid(&folio->page);
+}
+
+#endif /* _LINUX_MM_FOLIO_ZONE_H */
--
2.39.2
next prev parent reply other threads:[~2024-03-05 9:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 8:59 [PATCH v3 00/14] Fast kernel headers: split linux/mm.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 01/14] drivers: add missing includes on linux/mm.h (and others) Max Kellermann
2024-03-05 8:59 ` [PATCH v3 02/14] include/drm/drm_gem.h: add poll_table_struct forward declaration Max Kellermann
2024-03-05 8:59 ` [PATCH v3 03/14] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 04/14] linux/mm.h: move section functions to mm/page_section.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 05/14] linux/mm.h: move page_address() and others to mm/page_address.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 06/14] linux/mm.h: move folio_size(), ... to mm/folio_size.h Max Kellermann
2024-03-07 15:55 ` kernel test robot
2024-03-05 8:59 ` [PATCH v3 07/14] linux/mm.h: move folio_next() to mm/folio_next.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 08/14] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 09/14] linux/mm.h: move usage count functions to mm/folio_usage.h Max Kellermann
2024-03-05 8:59 ` Max Kellermann [this message]
2024-03-05 8:59 ` [PATCH v3 11/14] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 12/14] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 13/14] linux/mm.h: move high_memory to mm/high_memory.h Max Kellermann
2024-03-05 8:59 ` [PATCH v3 14/14] include: reduce dependencies on linux/mm.h Max Kellermann
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=20240305085919.1601395-11-max.kellermann@ionos.com \
--to=max.kellermann@ionos.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sfr@canb.auug.org.au \
--cc=willy@infradead.org \
/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