Skip to content

Commit e68f150

Browse files
committed
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>
1 parent 219f624 commit e68f150

3 files changed

Lines changed: 0 additions & 87 deletions

File tree

.clang-format

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ ForEachMacros:
294294
- 'for_each_fib6_node_rt_rcu'
295295
- 'for_each_fib6_walker_rt'
296296
- 'for_each_file_lock'
297-
- 'for_each_free_mem_pfn_range_in_zone_from'
298297
- 'for_each_free_mem_range'
299298
- 'for_each_free_mem_range_reverse'
300299
- 'for_each_func_rsrc'

include/linux/memblock.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -324,28 +324,6 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
324324
for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
325325
i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
326326

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 */
349327

350328
/**
351329
* for_each_free_mem_range - iterate through free memblock areas

mm/memblock.c

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,70 +1445,6 @@ int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size,
14451445
return 0;
14461446
}
14471447

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-
15121448
/**
15131449
* memblock_alloc_range_nid - allocate boot memory block
15141450
* @size: size of memory block to be allocated in bytes

0 commit comments

Comments
 (0)