diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-07-28 01:25:10 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-04 22:56:30 -0400 |
commit | 25818f0f288cd5333ba5a90ad6dde3def4c4ff58 (patch) | |
tree | 993384eff73bac874201d342c43a8e596dd1f485 | |
parent | 37d8d4bf489e39eedc9537f8616fe87879b13cb0 (diff) |
memblock: Make MEMBLOCK_ERROR be 0
And ensure we don't hand out 0 as a valid allocation. We put the
low limit at PAGE_SIZE arbitrarily.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | include/linux/memblock.h | 2 | ||||
-rw-r--r-- | mm/memblock.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 1a9c29cc92fa..dfa64494ced1 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <asm/memblock.h> | 19 | #include <asm/memblock.h> |
20 | 20 | ||
21 | #define INIT_MEMBLOCK_REGIONS 128 | 21 | #define INIT_MEMBLOCK_REGIONS 128 |
22 | #define MEMBLOCK_ERROR (~(phys_addr_t)0) | 22 | #define MEMBLOCK_ERROR 0 |
23 | 23 | ||
24 | struct memblock_region { | 24 | struct memblock_region { |
25 | phys_addr_t base; | 25 | phys_addr_t base; |
diff --git a/mm/memblock.c b/mm/memblock.c index 85cfa1d3ab28..cb520df2a414 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -105,6 +105,12 @@ static phys_addr_t __init memblock_find_region(phys_addr_t start, phys_addr_t en | |||
105 | phys_addr_t base, res_base; | 105 | phys_addr_t base, res_base; |
106 | long j; | 106 | long j; |
107 | 107 | ||
108 | /* Prevent allocations returning 0 as it's also used to | ||
109 | * indicate an allocation failure | ||
110 | */ | ||
111 | if (start == 0) | ||
112 | start = PAGE_SIZE; | ||
113 | |||
108 | base = memblock_align_down((end - size), align); | 114 | base = memblock_align_down((end - size), align); |
109 | while (start <= base) { | 115 | while (start <= base) { |
110 | j = memblock_overlaps_region(&memblock.reserved, base, size); | 116 | j = memblock_overlaps_region(&memblock.reserved, base, size); |