Yinghai Lu 5a982cbc7b mm: fix boundary checking in free_bootmem_core
With numa enabled, some callers could have a range of memory on one node
but try to free that on other node.  This can cause some pages to be
freed wrongly.

For example: when we try to allocate 128g boot ram early for
gart/swiotlb, and free that range later so gart/swiotlb can get some
range afterwards.

With this patch, we don't need to care which node holds the range, just
loop to call free_bootmem_node for all online nodes.

This patch makes free_bootmem_core() more robust by trimming the sidx
and eidx according the ram range that the node has.

And make the free_bootmem_core handle this out of range case.  We could
use bdata_list to make sure the range can be freed for sure.  So next
time, we don't need to loop online nodes and could use free_bootmem
directly.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Tested-by: Ingo Molnar <mingo@elte.hu>
Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-24 19:22:19 -07:00
..
2008-03-19 18:53:35 -07:00
2008-03-19 18:53:35 -07:00
2008-03-19 18:53:35 -07:00
2007-10-20 01:27:18 +02:00
2007-02-15 09:57:03 -08:00
2008-02-08 18:57:39 -08:00
2007-10-18 14:37:31 -07:00
2007-05-21 09:18:19 -07:00
2008-03-19 18:53:35 -07:00
2008-02-05 09:44:19 -08:00
2008-03-19 18:53:35 -07:00
2007-10-20 01:27:18 +02:00
2008-03-19 18:53:35 -07:00
2008-03-19 18:53:35 -07:00
2008-03-19 18:53:35 -07:00
2007-11-14 18:45:41 -08:00
2008-03-19 18:53:35 -07:00
2008-02-05 09:44:18 -08:00