All of lore.kernel.org
 help / color / mirror / Atom feed
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 v4 13/15] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h
Date: Tue, 12 Mar 2024 10:41:31 +0100	[thread overview]
Message-ID: <20240312094133.2084996-14-max.kellermann@ionos.com> (raw)
In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com>

This is needed to eliminate linux/dma-mapping.h's dependency on
linux/mm.h.

Signed-off-by: Max Kellermann <max.kellermann@ionos.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


  parent reply	other threads:[~2024-03-12  9:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  9:41 [PATCH v4 00/15] Fast kernel headers: split linux/mm.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 01/15] drivers: add missing includes on linux/mm.h (and others) Max Kellermann
2024-03-12  9:41 ` [PATCH v4 02/15] include/drm/drm_gem.h: add poll_table_struct forward declaration Max Kellermann
2024-03-12  9:41 ` [PATCH v4 03/15] include/scsi/scsicam.h: forward-declare struct block_device Max Kellermann
2024-03-12  9:41 ` [PATCH v4 04/15] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 05/15] linux/mm.h: move section functions to mm/page_section.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 06/15] linux/mm.h: move page_address() and others to mm/page_address.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 07/15] linux/mm.h: move folio_size(), ... to mm/folio_size.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 08/15] linux/mm.h: move folio_next() to mm/folio_next.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 09/15] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 10/15] linux/mm.h: move usage count functions to mm/folio_usage.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 11/15] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 12/15] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Max Kellermann
2024-03-12  9:41 ` Max Kellermann [this message]
2024-03-12  9:41 ` [PATCH v4 14/15] linux/mm.h: move high_memory to mm/high_memory.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 15/15] include: reduce dependencies on linux/mm.h Max Kellermann
2024-03-12 16:10 ` [PATCH v4 00/15] Fast kernel headers: split linux/mm.h David Hildenbrand
2024-03-12 16:27   ` Max Kellermann
2024-03-12 16:32     ` David Hildenbrand
2024-03-12 18:11       ` Max Kellermann
2024-03-12 19:26         ` David Hildenbrand
2024-03-12 19:50           ` 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=20240312094133.2084996-14-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.