linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: [Patch 4/4] memblock: compare current_limit with end variable at memblock_find_in_range_node()
Date: Mon, 14 May 2012 20:59:06 +0900	[thread overview]
Message-ID: <4FB0F38A.5020909@jp.fujitsu.com> (raw)
In-Reply-To: <4FB0F174.1000400@jp.fujitsu.com>

memblock_find_in_range_node() does not compare memblock.current_limit
with end variable. Thus even if memblock.current_limit is smaller than
end variable, the function allocates memory address that is bigger than
memblock.current_limit.

The patch adds the check to "memblock_find_in_range_node()"

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
  mm/memblock.c |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-3.4-rc6/mm/memblock.c
===================================================================
--- linux-3.4-rc6.orig/mm/memblock.c	2012-05-15 03:51:25.104153055 +0900
+++ linux-3.4-rc6/mm/memblock.c	2012-05-15 04:16:49.468094485 +0900
@@ -97,11 +97,12 @@ phys_addr_t __init_memblock memblock_fin
  					phys_addr_t align, int nid)
  {
  	phys_addr_t this_start, this_end, cand;
+	phys_addr_t current_limit = memblock.current_limit;
  	u64 i;

  	/* pump up @end */
-	if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
-		end = memblock.current_limit;
+	if ((end == MEMBLOCK_ALLOC_ACCESSIBLE) || (end > current_limit))
+		end = current_limit;

  	/* avoid allocating the first page */
  	start = max_t(phys_addr_t, start, PAGE_SIZE);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2012-05-14 11:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11  5:46 [PATCH] memory: add kernelcore_max_addr boot option Lai Jiangshan
2012-05-11 20:39 ` Andrew Morton
2012-05-14  2:33   ` Yasuaki Ishimatsu
2012-05-14 11:50 ` Yasuaki Ishimatsu
2012-05-14 11:58   ` [Patch 1/4] x86: get pg_data_t's memory from other node Yasuaki Ishimatsu
2012-05-14 11:58   ` [Patch 2/4] x86: use memblock_set_current_limit() to set memblock.current_limit Yasuaki Ishimatsu
2012-05-14 11:58   ` [Patch 3/4] memblock: limit memory address from memblock Yasuaki Ishimatsu
2012-05-14 16:52     ` Sam Ravnborg
2012-05-14 11:59   ` Yasuaki Ishimatsu [this message]
2012-05-14 12:01   ` [PATCH] memory: add kernelcore_max_addr boot option Yasuaki Ishimatsu

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=4FB0F38A.5020909@jp.fujitsu.com \
    --to=isimatu.yasuaki@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    /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