aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2012-05-29 18:06:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:21 -0400
commitc12ab504aa6076d1f1d37ee32431608ed11a1c3b (patch)
treeefe963c9536fe306380dd01d135daaf00f2c5154
parentc6785b6bf1b2a4b47238b24ee56f61e27c3af682 (diff)
mm: bootmem: split out goal-to-node mapping from goal dropping
Matching the desired goal to the right node is one thing, dropping the goal when it can not be satisfied is another. Split this into separate functions so that subsequent patches can use the node-finding but drop and handle the goal fallback on their own terms. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: David S. Miller <davem@davemloft.net> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/bootmem.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c
index ceed0df3944f..bafeb2c171c7 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -596,7 +596,7 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,
596 return NULL; 596 return NULL;
597} 597}
598 598
599static void * __init ___alloc_bootmem_nopanic(unsigned long size, 599static void * __init alloc_bootmem_core(unsigned long size,
600 unsigned long align, 600 unsigned long align,
601 unsigned long goal, 601 unsigned long goal,
602 unsigned long limit) 602 unsigned long limit)
@@ -604,7 +604,6 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,
604 bootmem_data_t *bdata; 604 bootmem_data_t *bdata;
605 void *region; 605 void *region;
606 606
607restart:
608 region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit); 607 region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit);
609 if (region) 608 if (region)
610 return region; 609 return region;
@@ -620,6 +619,20 @@ restart:
620 return region; 619 return region;
621 } 620 }
622 621
622 return NULL;
623}
624
625static void * __init ___alloc_bootmem_nopanic(unsigned long size,
626 unsigned long align,
627 unsigned long goal,
628 unsigned long limit)
629{
630 void *ptr;
631
632restart:
633 ptr = alloc_bootmem_core(size, align, goal, limit);
634 if (ptr)
635 return ptr;
623 if (goal) { 636 if (goal) {
624 goal = 0; 637 goal = 0;
625 goto restart; 638 goto restart;