projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c12ab50
)
mm: bootmem: allocate in order node+goal, goal, node, anywhere
author
Johannes Weiner
<
[email protected]
>
Tue, 29 May 2012 22:06:34 +0000
(15:06 -0700)
committer
Linus Torvalds
<
[email protected]
>
Tue, 29 May 2012 23:22:21 +0000
(16:22 -0700)
Match the nobootmem version of __alloc_bootmem_node. Try to satisfy both
the node and the goal, then just the goal, then just the node, then
allocate anywhere before panicking.
Signed-off-by: Johannes Weiner <
[email protected]
>
Acked-by: Tejun Heo <
[email protected]
>
Acked-by: David S. Miller <
[email protected]
>
Cc: Yinghai Lu <
[email protected]
>
Cc: Gavin Shan <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
mm/bootmem.c
patch
|
blob
|
history
diff --git
a/mm/bootmem.c
b/mm/bootmem.c
index bafeb2c171c757b551f01030f29399d5715011b0..b5babdfb9ef838be335ef942722fc6d4c8d35ae1 100644
(file)
--- a/
mm/bootmem.c
+++ b/
mm/bootmem.c
@@
-704,6
+704,7
@@
static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata,
{
void *ptr;
+again:
ptr = alloc_arch_preferred_bootmem(bdata, size, align, goal, limit);
if (ptr)
return ptr;
@@
-712,7
+713,18
@@
static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata,
if (ptr)
return ptr;
- return ___alloc_bootmem(size, align, goal, limit);
+ ptr = alloc_bootmem_core(size, align, goal, limit);
+ if (ptr)
+ return ptr;
+
+ if (goal) {
+ goal = 0;
+ goto again;
+ }
+
+ printk(KERN_ALERT "bootmem alloc of %lu bytes failed!\n", size);
+ panic("Out of memory");
+ return NULL;
}
/**