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

memblock: drop for_each_free_mem_pfn_range_in_zone_from()

for_each_free_mem_pfn_range_in_zone_from() and its "backend" implementation
__next_mem_pfn_range_in_zone() were only used by deferred initialization of
the memory map.

Remove them as they are not used anymore.

Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

-87
-1
.clang-format
··· 294 294 - 'for_each_fib6_node_rt_rcu' 295 295 - 'for_each_fib6_walker_rt' 296 296 - 'for_each_file_lock' 297 - - 'for_each_free_mem_pfn_range_in_zone_from' 298 297 - 'for_each_free_mem_range' 299 298 - 'for_each_free_mem_range_reverse' 300 299 - 'for_each_func_rsrc'
-22
include/linux/memblock.h
··· 324 324 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \ 325 325 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid)) 326 326 327 - #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT 328 - void __next_mem_pfn_range_in_zone(u64 *idx, struct zone *zone, 329 - unsigned long *out_spfn, 330 - unsigned long *out_epfn); 331 - 332 - /** 333 - * for_each_free_mem_pfn_range_in_zone_from - iterate through zone specific 334 - * free memblock areas from a given point 335 - * @i: u64 used as loop variable 336 - * @zone: zone in which all of the memory blocks reside 337 - * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 338 - * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 339 - * 340 - * Walks over free (memory && !reserved) areas of memblock in a specific 341 - * zone, continuing from current position. Available as soon as memblock is 342 - * initialized. 343 - */ 344 - #define for_each_free_mem_pfn_range_in_zone_from(i, zone, p_start, p_end) \ 345 - for (; i != U64_MAX; \ 346 - __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end)) 347 - 348 - #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ 349 327 350 328 /** 351 329 * for_each_free_mem_range - iterate through free memblock areas
-64
mm/memblock.c
··· 1445 1445 return 0; 1446 1446 } 1447 1447 1448 - #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT 1449 - /** 1450 - * __next_mem_pfn_range_in_zone - iterator for for_each_*_range_in_zone() 1451 - * 1452 - * @idx: pointer to u64 loop variable 1453 - * @zone: zone in which all of the memory blocks reside 1454 - * @out_spfn: ptr to ulong for start pfn of the range, can be %NULL 1455 - * @out_epfn: ptr to ulong for end pfn of the range, can be %NULL 1456 - * 1457 - * This function is meant to be a zone/pfn specific wrapper for the 1458 - * for_each_mem_range type iterators. Specifically they are used in the 1459 - * deferred memory init routines and as such we were duplicating much of 1460 - * this logic throughout the code. So instead of having it in multiple 1461 - * locations it seemed like it would make more sense to centralize this to 1462 - * one new iterator that does everything they need. 1463 - */ 1464 - void __init_memblock 1465 - __next_mem_pfn_range_in_zone(u64 *idx, struct zone *zone, 1466 - unsigned long *out_spfn, unsigned long *out_epfn) 1467 - { 1468 - int zone_nid = zone_to_nid(zone); 1469 - phys_addr_t spa, epa; 1470 - 1471 - __next_mem_range(idx, zone_nid, MEMBLOCK_NONE, 1472 - &memblock.memory, &memblock.reserved, 1473 - &spa, &epa, NULL); 1474 - 1475 - while (*idx != U64_MAX) { 1476 - unsigned long epfn = PFN_DOWN(epa); 1477 - unsigned long spfn = PFN_UP(spa); 1478 - 1479 - /* 1480 - * Verify the end is at least past the start of the zone and 1481 - * that we have at least one PFN to initialize. 1482 - */ 1483 - if (zone->zone_start_pfn < epfn && spfn < epfn) { 1484 - /* if we went too far just stop searching */ 1485 - if (zone_end_pfn(zone) <= spfn) { 1486 - *idx = U64_MAX; 1487 - break; 1488 - } 1489 - 1490 - if (out_spfn) 1491 - *out_spfn = max(zone->zone_start_pfn, spfn); 1492 - if (out_epfn) 1493 - *out_epfn = min(zone_end_pfn(zone), epfn); 1494 - 1495 - return; 1496 - } 1497 - 1498 - __next_mem_range(idx, zone_nid, MEMBLOCK_NONE, 1499 - &memblock.memory, &memblock.reserved, 1500 - &spa, &epa, NULL); 1501 - } 1502 - 1503 - /* signal end of iteration */ 1504 - if (out_spfn) 1505 - *out_spfn = ULONG_MAX; 1506 - if (out_epfn) 1507 - *out_epfn = 0; 1508 - } 1509 - 1510 - #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ 1511 - 1512 1448 /** 1513 1449 * memblock_alloc_range_nid - allocate boot memory block 1514 1450 * @size: size of memory block to be allocated in bytes