mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: michael@ellerman.id.au
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: bug in lmb_enforce_memory_limit()
Date: Fri, 15 Aug 2008 15:25:01 -0700 (PDT)	[thread overview]
Message-ID: <20080815.152501.193746275.davem@davemloft.net> (raw)
In-Reply-To: <1218713213.10673.17.camel@localhost>

From: Michael Ellerman <michael@ellerman.id.au>
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?

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];

  reply	other threads:[~2008-08-15 22:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14  8:20 David Miller
2008-08-14 11:26 ` Michael Ellerman
2008-08-15 22:25   ` David Miller [this message]
2008-08-16  0:46     ` Michael Ellerman
2008-08-16  2:57       ` David Miller
2008-08-18  2:00         ` Michael Ellerman
2008-08-18  2:03           ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080815.152501.193746275.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®