mm: page_alloc: move set_zone_contiguous() into mm_init.c
authorKefeng Wang <wangkefeng.wang@huawei.com>
Tue, 16 May 2023 06:38:11 +0000 (14:38 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 9 Jun 2023 23:25:22 +0000 (16:25 -0700)
set_zone_contiguous() is only used in mm init/hotplug, and
clear_zone_contiguous() only used in hotplug, move them from page_alloc.c
to the more appropriate file.

Link: https://lkml.kernel.org/r/20230516063821.121844-4-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Iurii Zaikin <yzaikin@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/memory_hotplug.h
mm/internal.h
mm/mm_init.c
mm/page_alloc.c

index 9fcbf57..04bc286 100644 (file)
@@ -326,9 +326,6 @@ static inline int remove_memory(u64 start, u64 size)
 static inline void __remove_memory(u64 start, u64 size) {}
 #endif /* CONFIG_MEMORY_HOTREMOVE */
 
-extern void set_zone_contiguous(struct zone *zone);
-extern void clear_zone_contiguous(struct zone *zone);
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 extern void __ref free_area_init_core_hotplug(struct pglist_data *pgdat);
 extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
index 68410c6..c99da2c 100644 (file)
@@ -371,6 +371,13 @@ static inline struct page *pageblock_pfn_to_page(unsigned long start_pfn,
        return __pageblock_pfn_to_page(start_pfn, end_pfn, zone);
 }
 
+void set_zone_contiguous(struct zone *zone);
+
+static inline void clear_zone_contiguous(struct zone *zone)
+{
+       zone->contiguous = false;
+}
+
 extern int __isolate_free_page(struct page *page, unsigned int order);
 extern void __putback_isolated_page(struct page *page, unsigned int order,
                                    int mt);
index 1520188..0fd4ddf 100644 (file)
@@ -2330,6 +2330,28 @@ void __init init_cma_reserved_pageblock(struct page *page)
 }
 #endif
 
+void set_zone_contiguous(struct zone *zone)
+{
+       unsigned long block_start_pfn = zone->zone_start_pfn;
+       unsigned long block_end_pfn;
+
+       block_end_pfn = pageblock_end_pfn(block_start_pfn);
+       for (; block_start_pfn < zone_end_pfn(zone);
+                       block_start_pfn = block_end_pfn,
+                        block_end_pfn += pageblock_nr_pages) {
+
+               block_end_pfn = min(block_end_pfn, zone_end_pfn(zone));
+
+               if (!__pageblock_pfn_to_page(block_start_pfn,
+                                            block_end_pfn, zone))
+                       return;
+               cond_resched();
+       }
+
+       /* We confirm that there is no hole */
+       zone->contiguous = true;
+}
+
 void __init page_alloc_init_late(void)
 {
        struct zone *zone;
index 4f094ba..7bb0d6a 100644 (file)
@@ -1532,33 +1532,6 @@ struct page *__pageblock_pfn_to_page(unsigned long start_pfn,
        return start_page;
 }
 
-void set_zone_contiguous(struct zone *zone)
-{
-       unsigned long block_start_pfn = zone->zone_start_pfn;
-       unsigned long block_end_pfn;
-
-       block_end_pfn = pageblock_end_pfn(block_start_pfn);
-       for (; block_start_pfn < zone_end_pfn(zone);
-                       block_start_pfn = block_end_pfn,
-                        block_end_pfn += pageblock_nr_pages) {
-
-               block_end_pfn = min(block_end_pfn, zone_end_pfn(zone));
-
-               if (!__pageblock_pfn_to_page(block_start_pfn,
-                                            block_end_pfn, zone))
-                       return;
-               cond_resched();
-       }
-
-       /* We confirm that there is no hole */
-       zone->contiguous = true;
-}
-
-void clear_zone_contiguous(struct zone *zone)
-{
-       zone->contiguous = false;
-}
-
 /*
  * The order of subdivision here is critical for the IO subsystem.
  * Please do not alter this order without good reasons and regression