Skip to content

Commit

Permalink
lmb: Fix reserved region handling in lmb_enforce_memory_limit().
Browse files Browse the repository at this point in the history
The idea of the implementation of this fix is from Michael Ellerman.

This function has two loops, but they each interpret the memory_limit
value differently.  The first loop interprets it as a "size limit"
whereas the second loop interprets it as an "address limit".

Before the second loop runs, reset memory_limit to lmb_end_of_DRAM()
so that it all works out.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Michael Ellerman <michael@ellerman.id.au>
  • Loading branch information
David S. Miller committed Aug 16, 2008
1 parent f2b6079 commit ebb1951
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/lmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ void __init lmb_enforce_memory_limit(u64 memory_limit)
if (lmb.memory.region[0].size < lmb.rmo_size)
lmb.rmo_size = lmb.memory.region[0].size;

memory_limit = lmb_end_of_DRAM();

/* And truncate any reserves above the limit also. */
for (i = 0; i < lmb.reserved.cnt; i++) {
p = &lmb.reserved.region[i];
Expand Down

0 comments on commit ebb1951

Please sign in to comment.