Skip to content

Commit

Permalink
mm: bootmem: split out goal-to-node mapping from goal dropping
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Weiner authored and Linus Torvalds committed May 29, 2012
1 parent c6785b6 commit c12ab50
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions mm/bootmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,14 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,
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 goal,
unsigned long limit)
{
bootmem_data_t *bdata;
void *region;

restart:
region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit);
if (region)
return region;
Expand All @@ -620,6 +619,20 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,
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) {
goal = 0;
goto restart;
Expand Down

0 comments on commit c12ab50

Please sign in to comment.