Re: bug in lmb_enforce_memory_limit()

From: Michael Ellerman
Date: Fri Aug 15 2008 - 20:46:37 EST


On Fri, 2008-08-15 at 15:25 -0700, David Miller wrote:
> From: Michael Ellerman <michael@xxxxxxxxxxxxxx>
> Date: Thu, 14 Aug 2008 21:26:53 +1000
>
> > Perhaps after the first loop we should set memory_limit to equal
> > lmb_end_of_DRAM(), then the second loop should work as it is.
>
> Sounds great. Mind if I push the following to Linus?

Looks good to me.

I'll test it on Monday. I don't know if I have a system with memory
holes to test on, but I take it you do?

I notice some of our 32-bit code is using lmb_enforce_memory_limit() to
enforce an address limit, which is technically broken, but is probably
fine because it doesn't need to worry about holes.


> 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@xxxxxxxxxxxxx>

Acked-by: Michael Ellerman <michael@xxxxxxxxxxxxxx>

cheers

--
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Attachment: signature.asc
Description: This is a digitally signed message part