From 1042bf56a3e06d8f052bd0b5c7d4661c4e05798f Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 12 Jul 2011 10:46:31 +0200 Subject: [PATCH] --- yaml --- r: 277141 b: refs/heads/master c: b2fea988f4f3b38ff4edfc1556a843c91932804c h: refs/heads/master i: 277139: 1e63d0d305d16887b199bf59a4ba7f2e61ff277e v: v3 --- [refs] | 2 +- trunk/mm/memblock.c | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/[refs] b/[refs] index 2ce91596070e..3b850216e4fb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c13291a536b835b2ab278ab201f2cb1ce22f2785 +refs/heads/master: b2fea988f4f3b38ff4edfc1556a843c91932804c diff --git a/trunk/mm/memblock.c b/trunk/mm/memblock.c index 0f9626f01b5e..97f3486ce4d6 100644 --- a/trunk/mm/memblock.c +++ b/trunk/mm/memblock.c @@ -511,28 +511,14 @@ phys_addr_t __init memblock_alloc(phys_addr_t size, phys_addr_t align) phys_addr_t __weak __init memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid) { #ifdef CONFIG_ARCH_POPULATES_NODE_MAP - /* - * This code originates from sparc which really wants use to walk by addresses - * and returns the nid. This is not very convenient for early_pfn_map[] users - * as the map isn't sorted yet, and it really wants to be walked by nid. - * - * For now, I implement the inefficient method below which walks the early - * map multiple times. Eventually we may want to use an ARCH config option - * to implement a completely different method for both case. - */ unsigned long start_pfn, end_pfn; int i; - for (i = 0; i < MAX_NUMNODES; i++) { - get_pfn_range_for_nid(i, &start_pfn, &end_pfn); - if (start < PFN_PHYS(start_pfn) || start >= PFN_PHYS(end_pfn)) - continue; - *nid = i; - return min(end, PFN_PHYS(end_pfn)); - } + for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, nid) + if (start >= PFN_PHYS(start_pfn) && start < PFN_PHYS(end_pfn)) + return min(end, PFN_PHYS(end_pfn)); #endif *nid = 0; - return end; }