Commit c12ab504 authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds

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: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c6785b6b
...@@ -596,7 +596,7 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, ...@@ -596,7 +596,7 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,
return NULL; return NULL;
} }
static void * __init ___alloc_bootmem_nopanic(unsigned long size, static void * __init alloc_bootmem_core(unsigned long size,
unsigned long align, unsigned long align,
unsigned long goal, unsigned long goal,
unsigned long limit) unsigned long limit)
...@@ -604,7 +604,6 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size, ...@@ -604,7 +604,6 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,
bootmem_data_t *bdata; bootmem_data_t *bdata;
void *region; void *region;
restart:
region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit); region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit);
if (region) if (region)
return region; return region;
...@@ -620,6 +619,20 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size, ...@@ -620,6 +619,20 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,
return region; return region;
} }
return NULL;
}
static void * __init ___alloc_bootmem_nopanic(unsigned long size,
unsigned long align,
unsigned long goal,
unsigned long limit)
{
void *ptr;
restart:
ptr = alloc_bootmem_core(size, align, goal, limit);
if (ptr)
return ptr;
if (goal) { if (goal) {
goal = 0; goal = 0;
goto restart; goto restart;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment