Re: bug in lmb_enforce_memory_limit()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Miller
Date: Friday, August 15, 2008 - 3:25 pm

From: Michael Ellerman <michael@ellerman.id.au>
Date: Thu, 14 Aug 2008 21:26:53 +1000


Sounds great.  Mind if I push the following to Linus?

lmb: Fix reserved region handling in lmb_enforce_memory_limit().

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>

diff --git a/lib/lmb.c b/lib/lmb.c
index 5d7b928..97e5470 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -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];
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
bug in lmb_enforce_memory_limit(), David Miller, (Thu Aug 14, 1:20 am)
Re: bug in lmb_enforce_memory_limit(), Michael Ellerman, (Thu Aug 14, 4:26 am)
Re: bug in lmb_enforce_memory_limit(), David Miller, (Fri Aug 15, 3:25 pm)
Re: bug in lmb_enforce_memory_limit(), Michael Ellerman, (Fri Aug 15, 5:46 pm)
Re: bug in lmb_enforce_memory_limit(), David Miller, (Fri Aug 15, 7:57 pm)
Re: bug in lmb_enforce_memory_limit(), Michael Ellerman, (Sun Aug 17, 7:00 pm)
Re: bug in lmb_enforce_memory_limit(), David Miller, (Sun Aug 17, 7:03 pm)