Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: page_alloc: move set_zone_contiguous() into mm_init.c

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>

authored by

Kefeng Wang and committed by
Andrew Morton
904d5857 5e7d5da2

+29 -30
-3
include/linux/memory_hotplug.h
··· 326 326 static inline void __remove_memory(u64 start, u64 size) {} 327 327 #endif /* CONFIG_MEMORY_HOTREMOVE */ 328 328 329 - extern void set_zone_contiguous(struct zone *zone); 330 - extern void clear_zone_contiguous(struct zone *zone); 331 - 332 329 #ifdef CONFIG_MEMORY_HOTPLUG 333 330 extern void __ref free_area_init_core_hotplug(struct pglist_data *pgdat); 334 331 extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
+7
mm/internal.h
··· 371 371 return __pageblock_pfn_to_page(start_pfn, end_pfn, zone); 372 372 } 373 373 374 + void set_zone_contiguous(struct zone *zone); 375 + 376 + static inline void clear_zone_contiguous(struct zone *zone) 377 + { 378 + zone->contiguous = false; 379 + } 380 + 374 381 extern int __isolate_free_page(struct page *page, unsigned int order); 375 382 extern void __putback_isolated_page(struct page *page, unsigned int order, 376 383 int mt);
+22
mm/mm_init.c
··· 2330 2330 } 2331 2331 #endif 2332 2332 2333 + void set_zone_contiguous(struct zone *zone) 2334 + { 2335 + unsigned long block_start_pfn = zone->zone_start_pfn; 2336 + unsigned long block_end_pfn; 2337 + 2338 + block_end_pfn = pageblock_end_pfn(block_start_pfn); 2339 + for (; block_start_pfn < zone_end_pfn(zone); 2340 + block_start_pfn = block_end_pfn, 2341 + block_end_pfn += pageblock_nr_pages) { 2342 + 2343 + block_end_pfn = min(block_end_pfn, zone_end_pfn(zone)); 2344 + 2345 + if (!__pageblock_pfn_to_page(block_start_pfn, 2346 + block_end_pfn, zone)) 2347 + return; 2348 + cond_resched(); 2349 + } 2350 + 2351 + /* We confirm that there is no hole */ 2352 + zone->contiguous = true; 2353 + } 2354 + 2333 2355 void __init page_alloc_init_late(void) 2334 2356 { 2335 2357 struct zone *zone;
-27
mm/page_alloc.c
··· 1532 1532 return start_page; 1533 1533 } 1534 1534 1535 - void set_zone_contiguous(struct zone *zone) 1536 - { 1537 - unsigned long block_start_pfn = zone->zone_start_pfn; 1538 - unsigned long block_end_pfn; 1539 - 1540 - block_end_pfn = pageblock_end_pfn(block_start_pfn); 1541 - for (; block_start_pfn < zone_end_pfn(zone); 1542 - block_start_pfn = block_end_pfn, 1543 - block_end_pfn += pageblock_nr_pages) { 1544 - 1545 - block_end_pfn = min(block_end_pfn, zone_end_pfn(zone)); 1546 - 1547 - if (!__pageblock_pfn_to_page(block_start_pfn, 1548 - block_end_pfn, zone)) 1549 - return; 1550 - cond_resched(); 1551 - } 1552 - 1553 - /* We confirm that there is no hole */ 1554 - zone->contiguous = true; 1555 - } 1556 - 1557 - void clear_zone_contiguous(struct zone *zone) 1558 - { 1559 - zone->contiguous = false; 1560 - } 1561 - 1562 1535 /* 1563 1536 * The order of subdivision here is critical for the IO subsystem. 1564 1537 * Please do not alter this order without good reasons and regression