Commit 2dd23d7c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix bootmem allocator on machines with holes in

From: Anton Blanchard <anton@samba.org>

If the memory we are trying to allocate is too large to fit in the current
region, we should skip to the end.  We currently search the available
bitmap, find the area is too small, increment the start by incr and try
again.  This resulted in an apparent lockup on a 64GB machine that had a
3GB IO hole starting at 1GB (and the mem_map array would not fit in the
first region).

Also use ALIGN macro instead of an open coded version.
parent 77d7ccc8
......@@ -183,7 +183,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
for (i = preferred; i < eidx; i += incr) {
unsigned long j;
i = find_next_zero_bit(bdata->node_bootmem_map, eidx, i);
i = (i + incr - 1) & -incr;
i = ALIGN(i, incr);
if (test_bit(i, bdata->node_bootmem_map))
continue;
for (j = i + 1; j < i + areasize; ++j) {
......@@ -195,7 +195,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
start = i;
goto found;
fail_block:
;
i = ALIGN(j, incr);
}
if (preferred > offset) {
......
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