aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 603513609ba5..da0fe32059b3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3616,34 +3616,6 @@ static int __meminit next_active_region_index_in_nid(int index, int nid)
3616 return -1; 3616 return -1;
3617} 3617}
3618 3618
3619/*
3620 * Basic iterator support. Return the last range of PFNs for a node
3621 * Note: nid == MAX_NUMNODES returns last region regardless of node
3622 */
3623static int __meminit last_active_region_index_in_nid(int nid)
3624{
3625 int i;
3626
3627 for (i = nr_nodemap_entries - 1; i >= 0; i--)
3628 if (nid == MAX_NUMNODES || early_node_map[i].nid == nid)
3629 return i;
3630
3631 return -1;
3632}
3633
3634/*
3635 * Basic iterator support. Return the previous active range of PFNs for a node
3636 * Note: nid == MAX_NUMNODES returns next region regardless of node
3637 */
3638static int __meminit previous_active_region_index_in_nid(int index, int nid)
3639{
3640 for (index = index - 1; index >= 0; index--)
3641 if (nid == MAX_NUMNODES || early_node_map[index].nid == nid)
3642 return index;
3643
3644 return -1;
3645}
3646
3647#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 3619#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
3648/* 3620/*
3649 * Required by SPARSEMEM. Given a PFN, return what node the PFN is on. 3621 * Required by SPARSEMEM. Given a PFN, return what node the PFN is on.
@@ -3695,10 +3667,6 @@ bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
3695 for (i = first_active_region_index_in_nid(nid); i != -1; \ 3667 for (i = first_active_region_index_in_nid(nid); i != -1; \
3696 i = next_active_region_index_in_nid(i, nid)) 3668 i = next_active_region_index_in_nid(i, nid))
3697 3669
3698#define for_each_active_range_index_in_nid_reverse(i, nid) \
3699 for (i = last_active_region_index_in_nid(nid); i != -1; \
3700 i = previous_active_region_index_in_nid(i, nid))
3701
3702/** 3670/**
3703 * free_bootmem_with_active_regions - Call free_bootmem_node for each active range 3671 * free_bootmem_with_active_regions - Call free_bootmem_node for each active range
3704 * @nid: The node to free memory on. If MAX_NUMNODES, all nodes are freed. 3672 * @nid: The node to free memory on. If MAX_NUMNODES, all nodes are freed.
@@ -3731,6 +3699,38 @@ void __init free_bootmem_with_active_regions(int nid,
3731} 3699}
3732 3700
3733#ifdef CONFIG_HAVE_MEMBLOCK 3701#ifdef CONFIG_HAVE_MEMBLOCK
3702/*
3703 * Basic iterator support. Return the last range of PFNs for a node
3704 * Note: nid == MAX_NUMNODES returns last region regardless of node
3705 */
3706static int __meminit last_active_region_index_in_nid(int nid)
3707{
3708 int i;
3709
3710 for (i = nr_nodemap_entries - 1; i >= 0; i--)
3711 if (nid == MAX_NUMNODES || early_node_map[i].nid == nid)
3712 return i;
3713
3714 return -1;
3715}
3716
3717/*
3718 * Basic iterator support. Return the previous active range of PFNs for a node
3719 * Note: nid == MAX_NUMNODES returns next region regardless of node
3720 */
3721static int __meminit previous_active_region_index_in_nid(int index, int nid)
3722{
3723 for (index = index - 1; index >= 0; index--)
3724 if (nid == MAX_NUMNODES || early_node_map[index].nid == nid)
3725 return index;
3726
3727 return -1;
3728}
3729
3730#define for_each_active_range_index_in_nid_reverse(i, nid) \
3731 for (i = last_active_region_index_in_nid(nid); i != -1; \
3732 i = previous_active_region_index_in_nid(i, nid))
3733
3734u64 __init find_memory_core_early(int nid, u64 size, u64 align, 3734u64 __init find_memory_core_early(int nid, u64 size, u64 align,
3735 u64 goal, u64 limit) 3735 u64 goal, u64 limit)
3736{ 3736{