aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2022-02-17 10:09:04 +0100
committerIngo Molnar <mingo@kernel.org>2022-03-15 12:57:33 +0100
commit10181c7f24ccf76bd6193ef09ea5b49a34c01825 (patch)
tree5817f6c7a65143a598839d866637de05f1e9b6bc
parent37b3d3fa9f12f9d9c955deec8d10881a0d052d12 (diff)
downloadtip-10181c7f24ccf76bd6193ef09ea5b49a34c01825.tar.gz
headers/deps: mm: Optimize <linux/mm_api.h> dependencies, remove <linux/mmzone_api.h> dependency
-------------------------------------------------------------------- | Combined, preprocessed C code size of header, without line markers, | with comments stripped: ------------------------- before: | #include <linux/mm_api.h> | LOC: 10,759 | headers: 287 after: | #include <linux/mm_api.h> | LOC: 10,116 | headers: 272 Fix up dangling dependencies. Also move over is_highmem_idx() and is_highmem() to <linux/mmzone_types.h> - two trivial wrappers with no further dependencies. Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/linux/highmem.h4
-rw-r--r--include/linux/mm_api.h5
-rw-r--r--include/linux/mm_inline.h1
-rw-r--r--include/linux/mmzone_api.h35
-rw-r--r--include/linux/mmzone_types.h31
-rw-r--r--include/linux/vmstat.h2
6 files changed, 46 insertions, 32 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 359e35e8e18862..a6273310573cbc 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -12,6 +12,10 @@
#include <linux/mm.h>
#include <linux/uaccess.h>
+#ifdef CONFIG_HIGHMEM
+# include <asm/highmem.h>
+#endif
+
/* This memory layout mode's definitions are full of layering violations & require this header: */
#ifdef CONFIG_SPARSEMEM
#include <linux/mm_api.h>
diff --git a/include/linux/mm_api.h b/include/linux/mm_api.h
index 43885a14987f01..3c8f3933261637 100644
--- a/include/linux/mm_api.h
+++ b/include/linux/mm_api.h
@@ -27,7 +27,10 @@
#include <linux/gfp_types.h>
#include <linux/bug.h>
#include <linux/list.h>
-#include <linux/mmzone_api.h>
+#include <linux/mmzone_types.h>
+#include <asm/mmzone.h>
+#include <linux/nodemask.h>
+#include <linux/string.h>
#include <linux/rbtree.h>
#include <linux/atomic.h>
#include <linux/debug_locks.h>
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 5fccda749d3f5a..5a86681045db9d 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -2,6 +2,7 @@
#ifndef LINUX_MM_INLINE_H
#define LINUX_MM_INLINE_H
+#include <linux/mmzone_api.h>
#include <linux/mm_api.h>
#include <linux/memcontrol.h>
#include <linux/atomic.h>
diff --git a/include/linux/mmzone_api.h b/include/linux/mmzone_api.h
index 2b95254cc0b891..51edfd6c9d0531 100644
--- a/include/linux/mmzone_api.h
+++ b/include/linux/mmzone_api.h
@@ -29,6 +29,10 @@
#include <linux/local_lock.h>
#include <asm/page.h>
+#ifdef CONFIG_HIGHMEM
+# include <asm/highmem.h>
+#endif
+
#ifdef CONFIG_CMA
# define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA)
# define is_migrate_cma_page(_page) (get_pageblock_migratetype(_page) == MIGRATE_CMA)
@@ -166,11 +170,6 @@ int local_memory_node(int node_id);
static inline int local_memory_node(int node_id) { return node_id; };
#endif
-/*
- * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc.
- */
-#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
-
#ifdef CONFIG_ZONE_DEVICE
static inline bool zone_is_zone_device(struct zone *zone)
{
@@ -219,16 +218,6 @@ static inline int zone_to_nid(struct zone *zone)
static inline void zone_set_nid(struct zone *zone, int nid) {}
#endif
-static inline int is_highmem_idx(enum zone_type idx)
-{
-#ifdef CONFIG_HIGHMEM
- return (idx == ZONE_HIGHMEM ||
- (idx == ZONE_MOVABLE && movable_zone == ZONE_HIGHMEM));
-#else
- return 0;
-#endif
-}
-
#ifdef CONFIG_ZONE_DMA
bool has_managed_dma(void);
#else
@@ -238,22 +227,6 @@ static inline bool has_managed_dma(void)
}
#endif
-/**
- * is_highmem - helper function to quickly check if a struct zone is a
- * highmem zone or not. This is an attempt to keep references
- * to ZONE_{DMA/NORMAL/HIGHMEM/etc} in general code to a minimum.
- * @zone: pointer to struct zone variable
- * Return: 1 for a highmem zone, 0 otherwise
- */
-static inline int is_highmem(struct zone *zone)
-{
-#ifdef CONFIG_HIGHMEM
- return is_highmem_idx(zone_idx(zone));
-#else
- return 0;
-#endif
-}
-
/* These two functions are used to setup the per zone pages min values */
struct ctl_table;
diff --git a/include/linux/mmzone_types.h b/include/linux/mmzone_types.h
index 993288d7bd957d..60cada4056a019 100644
--- a/include/linux/mmzone_types.h
+++ b/include/linux/mmzone_types.h
@@ -823,6 +823,37 @@ static inline void set_max_mapnr(unsigned long limit)
static inline void set_max_mapnr(unsigned long limit) { }
#endif
+static inline int is_highmem_idx(enum zone_type idx)
+{
+#ifdef CONFIG_HIGHMEM
+ return (idx == ZONE_HIGHMEM ||
+ (idx == ZONE_MOVABLE && movable_zone == ZONE_HIGHMEM));
+#else
+ return 0;
+#endif
+}
+
+/*
+ * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc.
+ */
+#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
+
+/**
+ * is_highmem - helper function to quickly check if a struct zone is a
+ * highmem zone or not. This is an attempt to keep references
+ * to ZONE_{DMA/NORMAL/HIGHMEM/etc} in general code to a minimum.
+ * @zone: pointer to struct zone variable
+ * Return: 1 for a highmem zone, 0 otherwise
+ */
+static inline int is_highmem(struct zone *zone)
+{
+#ifdef CONFIG_HIGHMEM
+ return is_highmem_idx(zone_idx(zone));
+#else
+ return 0;
+#endif
+}
+
#endif /* !__GENERATING_BOUNDS.H */
#endif /* _LINUX_MMZONE_TYPES_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index db5737468fb96d..9f09838e48be56 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -2,12 +2,14 @@
#ifndef _LINUX_VMSTAT_H
#define _LINUX_VMSTAT_H
+#include <linux/mmzone_api.h>
#include <linux/irqflags.h>
#include <linux/preempt.h>
#include <linux/cpumask_api.h>
#include <linux/mm_api.h>
#include <linux/mm_page_address.h>
#include <linux/vm_event_item.h>
+#include <linux/smp_api.h>
extern int sysctl_stat_interval;