[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240305085919.1601395-13-max.kellermann@ionos.com>
Date: Tue, 5 Mar 2024 09:59:17 +0100
From: Max Kellermann <max.kellermann@...os.com>
To: akpm@...ux-foundation.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: willy@...radead.org,
sfr@...b.auug.org.au,
Max Kellermann <max.kellermann@...os.com>
Subject: [PATCH v3 12/14] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h
This is needed to eliminate linux/dma-mapping.h's dependency on
linux/mm.h.
Signed-off-by: Max Kellermann <max.kellermann@...os.com>
---
include/linux/mm.h | 25 +------------------------
include/linux/mm/vmalloc_addr.h | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 24 deletions(-)
create mode 100644 include/linux/mm/vmalloc_addr.h
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 07262ae43c5d..80fc7df2856a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -9,6 +9,7 @@
#include <linux/mm/page_address.h>
#include <linux/mm/page_section.h>
#include <linux/mm/pfmemalloc.h>
+#include <linux/mm/vmalloc_addr.h>
#include <linux/errno.h>
#include <linux/mmdebug.h>
#include <linux/gfp.h>
@@ -1086,30 +1087,6 @@ enum {
int region_intersects(resource_size_t offset, size_t size, unsigned long flags,
unsigned long desc);
-/* Support for virtually mapped pages */
-struct page *vmalloc_to_page(const void *addr);
-unsigned long vmalloc_to_pfn(const void *addr);
-
-/*
- * Determine if an address is within the vmalloc range
- *
- * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
- * is no special casing required.
- */
-#ifdef CONFIG_MMU
-extern bool is_vmalloc_addr(const void *x);
-extern int is_vmalloc_or_module_addr(const void *x);
-#else
-static inline bool is_vmalloc_addr(const void *x)
-{
- return false;
-}
-static inline int is_vmalloc_or_module_addr(const void *x)
-{
- return 0;
-}
-#endif
-
/*
* How many times the entire folio is mapped as a single unit (eg by a
* PMD or PUD entry). This is probably not what you want, except for
diff --git a/include/linux/mm/vmalloc_addr.h b/include/linux/mm/vmalloc_addr.h
new file mode 100644
index 000000000000..86ad2dc94960
--- /dev/null
+++ b/include/linux/mm/vmalloc_addr.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_MM_VMALLOC_ADDR_H
+#define _LINUX_MM_VMALLOC_ADDR_H
+
+#include <linux/types.h> // for bool
+
+struct page;
+
+/* Support for virtually mapped pages */
+struct page *vmalloc_to_page(const void *addr);
+unsigned long vmalloc_to_pfn(const void *addr);
+
+/*
+ * Determine if an address is within the vmalloc range
+ *
+ * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
+ * is no special casing required.
+ */
+#ifdef CONFIG_MMU
+extern bool is_vmalloc_addr(const void *x);
+extern int is_vmalloc_or_module_addr(const void *x);
+#else
+static inline bool is_vmalloc_addr(const void *x)
+{
+ return false;
+}
+static inline int is_vmalloc_or_module_addr(const void *x)
+{
+ return 0;
+}
+#endif
+
+#endif /* _LINUX_MM_VMALLOC_ADDR_H */
--
2.39.2
Powered by blists - more mailing lists