linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Bug fix 0/4] Bug fix for movablecore_map boot option.
@ 2013-01-22 11:46 Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 1/4] Bug fix: Use CONFIG_HAVE_MEMBLOCK_NODE_MAP to protect movablecore_map in memblock_overlaps_region() Tang Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tang Chen @ 2013-01-22 11:46 UTC (permalink / raw)
  To: akpm, rientjes, len.brown, benh, paulus, cl, minchan.kim,
	kosaki.motohiro, isimatu.yasuaki, wujianguo, wency, hpa, linfeng,
	laijs, mgorman, yinghai, glommer, jiang.liu, julian.calaby, sfr
  Cc: linux-mm, x86, linuxppc-dev, linux-kernel, linux-acpi

Hi Andrew,

patch1 ~ patch3 fix some problems of movablecore_map boot option.
And since the name "core" could be confused, patch4 rename this option
to movablemem_map.

All these patches are based on the latest -mm tree.
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm

Tang Chen (4):
  Bug fix: Use CONFIG_HAVE_MEMBLOCK_NODE_MAP to protect movablecore_map
    in memblock_overlaps_region().
  Bug fix: Fix the doc format.
  Bug fix: Remove the unused sanitize_zone_movable_limit() definition.
  Rename movablecore_map to movablemem_map.

 Documentation/kernel-parameters.txt |    8 +-
 include/linux/memblock.h            |    3 +-
 include/linux/mm.h                  |    8 +-
 mm/memblock.c                       |   42 +++++++++++-
 mm/page_alloc.c                     |  116 +++++++++++++++++-----------------
 5 files changed, 106 insertions(+), 71 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH Bug fix 1/4] Bug fix: Use CONFIG_HAVE_MEMBLOCK_NODE_MAP to protect movablecore_map in memblock_overlaps_region().
  2013-01-22 11:46 [PATCH Bug fix 0/4] Bug fix for movablecore_map boot option Tang Chen
@ 2013-01-22 11:46 ` Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 2/4] Bug fix: Fix the doc format Tang Chen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tang Chen @ 2013-01-22 11:46 UTC (permalink / raw)
  To: akpm, rientjes, len.brown, benh, paulus, cl, minchan.kim,
	kosaki.motohiro, isimatu.yasuaki, wujianguo, wency, hpa, linfeng,
	laijs, mgorman, yinghai, glommer, jiang.liu, julian.calaby, sfr
  Cc: linux-mm, x86, linuxppc-dev, linux-kernel, linux-acpi

The definition of struct movablecore_map is protected by
CONFIG_HAVE_MEMBLOCK_NODE_MAP but its use in memblock_overlaps_region()
is not. So add CONFIG_HAVE_MEMBLOCK_NODE_MAP to protect the use of
movablecore_map in memblock_overlaps_region().

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
 include/linux/memblock.h |    3 ++-
 mm/memblock.c            |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 6e25597..ac52bbc 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -42,7 +42,6 @@ struct memblock {
 
 extern struct memblock memblock;
 extern int memblock_debug;
-extern struct movablecore_map movablecore_map;
 
 #define memblock_dbg(fmt, ...) \
 	if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
@@ -61,6 +60,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
 void memblock_trim_memory(phys_addr_t align);
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
+extern struct movablecore_map movablecore_map;
+
 void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
 			  unsigned long *out_end_pfn, int *out_nid);
 
diff --git a/mm/memblock.c b/mm/memblock.c
index 1e48774..0218231 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -92,9 +92,13 @@ static long __init_memblock memblock_overlaps_region(struct memblock_type *type,
  *
  * Find @size free area aligned to @align in the specified range and node.
  *
+ * If we have CONFIG_HAVE_MEMBLOCK_NODE_MAP defined, we need to check if the
+ * memory we found if not in hotpluggable ranges.
+ *
  * RETURNS:
  * Found address on success, %0 on failure.
  */
+#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
 					phys_addr_t end, phys_addr_t size,
 					phys_addr_t align, int nid)
@@ -139,6 +143,36 @@ restart:
 
 	return 0;
 }
+#else /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
+phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
+					phys_addr_t end, phys_addr_t size,
+					phys_addr_t align, int nid)
+{
+	phys_addr_t this_start, this_end, cand;
+	u64 i;
+
+	/* pump up @end */
+	if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
+		end = memblock.current_limit;
+
+	/* avoid allocating the first page */
+	start = max_t(phys_addr_t, start, PAGE_SIZE);
+	end = max(start, end);
+
+	for_each_free_mem_range_reverse(i, nid, &this_start, &this_end, NULL) {
+		this_start = clamp(this_start, start, end);
+		this_end = clamp(this_end, start, end);
+
+		if (this_end < size)
+			continue;
+
+		cand = round_down(this_end - size, align);
+		if (cand >= this_start)
+			return cand;
+	}
+	return 0;
+}
+#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
 
 /**
  * memblock_find_in_range - find free area in given range
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH Bug fix 2/4] Bug fix: Fix the doc format.
  2013-01-22 11:46 [PATCH Bug fix 0/4] Bug fix for movablecore_map boot option Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 1/4] Bug fix: Use CONFIG_HAVE_MEMBLOCK_NODE_MAP to protect movablecore_map in memblock_overlaps_region() Tang Chen
@ 2013-01-22 11:46 ` Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 3/4] Bug fix: Remove the unused sanitize_zone_movable_limit() definition Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 4/4] Rename movablecore_map to movablemem_map Tang Chen
  3 siblings, 0 replies; 5+ messages in thread
From: Tang Chen @ 2013-01-22 11:46 UTC (permalink / raw)
  To: akpm, rientjes, len.brown, benh, paulus, cl, minchan.kim,
	kosaki.motohiro, isimatu.yasuaki, wujianguo, wency, hpa, linfeng,
	laijs, mgorman, yinghai, glommer, jiang.liu, julian.calaby, sfr
  Cc: linux-mm, x86, linuxppc-dev, linux-kernel, linux-acpi

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
 mm/page_alloc.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 00037a3..cd6f8a6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4372,7 +4372,7 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid,
 }
 
 /**
- * sanitize_zone_movable_limit - Sanitize the zone_movable_limit array.
+ * sanitize_zone_movable_limit() - Sanitize the zone_movable_limit array.
  *
  * zone_movable_limit is initialized as 0. This function will try to get
  * the first ZONE_MOVABLE pfn of each node from movablecore_map, and
@@ -5173,9 +5173,9 @@ early_param("kernelcore", cmdline_parse_kernelcore);
 early_param("movablecore", cmdline_parse_movablecore);
 
 /**
- * insert_movablecore_map - Insert a memory range in to movablecore_map.map.
- * @start_pfn: start pfn of the range
- * @end_pfn: end pfn of the range
+ * insert_movablecore_map() - Insert a memory range in to movablecore_map.map.
+ * @start_pfn:	start pfn of the range
+ * @end_pfn:	end pfn of the range
  *
  * This function will also merge the overlapped ranges, and sort the array
  * by start_pfn in monotonic increasing order.
@@ -5236,9 +5236,9 @@ static void __init insert_movablecore_map(unsigned long start_pfn,
 }
 
 /**
- * movablecore_map_add_region - Add a memory range into movablecore_map.
- * @start: physical start address of range
- * @end: physical end address of range
+ * movablecore_map_add_region() - Add a memory range into movablecore_map.
+ * @start:	physical start address of range
+ * @end:	physical end address of range
  *
  * This function transform the physical address into pfn, and then add the
  * range into movablecore_map by calling insert_movablecore_map().
@@ -5265,8 +5265,13 @@ static void __init movablecore_map_add_region(u64 start, u64 size)
 }
 
 /*
- * movablecore_map=nn[KMG]@ss[KMG] sets the region of memory to be used as
- * movable memory.
+ * cmdline_parse_movablecore_map() - Parse boot option movablecore_map.
+ * @p:	The boot option of the following format:
+ * 	movablecore_map=nn[KMG]@ss[KMG]
+ *
+ * This option sets the memory range [ss, ss+nn) to be used as movable memory.
+ *
+ * Return: 0 on success or -EINVAL on failure.
  */
 static int __init cmdline_parse_movablecore_map(char *p)
 {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH Bug fix 3/4] Bug fix: Remove the unused sanitize_zone_movable_limit() definition.
  2013-01-22 11:46 [PATCH Bug fix 0/4] Bug fix for movablecore_map boot option Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 1/4] Bug fix: Use CONFIG_HAVE_MEMBLOCK_NODE_MAP to protect movablecore_map in memblock_overlaps_region() Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 2/4] Bug fix: Fix the doc format Tang Chen
@ 2013-01-22 11:46 ` Tang Chen
  2013-01-22 11:46 ` [PATCH Bug fix 4/4] Rename movablecore_map to movablemem_map Tang Chen
  3 siblings, 0 replies; 5+ messages in thread
From: Tang Chen @ 2013-01-22 11:46 UTC (permalink / raw)
  To: akpm, rientjes, len.brown, benh, paulus, cl, minchan.kim,
	kosaki.motohiro, isimatu.yasuaki, wujianguo, wency, hpa, linfeng,
	laijs, mgorman, yinghai, glommer, jiang.liu, julian.calaby, sfr
  Cc: linux-mm, x86, linuxppc-dev, linux-kernel, linux-acpi

When CONFIG_HAVE_MEMBLOCK_NODE_MAP is not defined, sanitize_zone_movable_limit()
is also not used. So remove it.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
 mm/page_alloc.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index cd6f8a6..2bd529e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4459,11 +4459,6 @@ static inline unsigned long __meminit zone_absent_pages_in_node(int nid,
 
 	return zholes_size[zone_type];
 }
-
-static void __meminit sanitize_zone_movable_limit(void)
-{
-}
-
 #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
 
 static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH Bug fix 4/4] Rename movablecore_map to movablemem_map.
  2013-01-22 11:46 [PATCH Bug fix 0/4] Bug fix for movablecore_map boot option Tang Chen
                   ` (2 preceding siblings ...)
  2013-01-22 11:46 ` [PATCH Bug fix 3/4] Bug fix: Remove the unused sanitize_zone_movable_limit() definition Tang Chen
@ 2013-01-22 11:46 ` Tang Chen
  3 siblings, 0 replies; 5+ messages in thread
From: Tang Chen @ 2013-01-22 11:46 UTC (permalink / raw)
  To: akpm, rientjes, len.brown, benh, paulus, cl, minchan.kim,
	kosaki.motohiro, isimatu.yasuaki, wujianguo, wency, hpa, linfeng,
	laijs, mgorman, yinghai, glommer, jiang.liu, julian.calaby, sfr
  Cc: linux-mm, x86, linuxppc-dev, linux-kernel, linux-acpi

Since "core" could be confused with cpu cores, but here it is memory,
so rename the boot option movablecore_map to movablemem_map.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
 Documentation/kernel-parameters.txt |    8 ++--
 include/linux/memblock.h            |    2 +-
 include/linux/mm.h                  |    8 ++--
 mm/memblock.c                       |    8 ++--
 mm/page_alloc.c                     |   96 +++++++++++++++++-----------------
 5 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index f02aa4c..7770611 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1637,7 +1637,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			that the amount of memory usable for all allocations
 			is not too small.
 
-	movablecore_map=nn[KMG]@ss[KMG]
+	movablemem_map=nn[KMG]@ss[KMG]
 			[KNL,X86,IA-64,PPC] This parameter is similar to
 			memmap except it specifies the memory map of
 			ZONE_MOVABLE.
@@ -1647,11 +1647,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			ss to the end of the 1st node will be ZONE_MOVABLE,
 			and all the rest nodes will only have ZONE_MOVABLE.
 			If memmap is specified at the same time, the
-			movablecore_map will be limited within the memmap
+			movablemem_map will be limited within the memmap
 			areas. If kernelcore or movablecore is also specified,
-			movablecore_map will have higher priority to be
+			movablemem_map will have higher priority to be
 			satisfied. So the administrator should be careful that
-			the amount of movablecore_map areas are not too large.
+			the amount of movablemem_map areas are not too large.
 			Otherwise kernel won't have enough memory to start.
 
 	MTD_Partition=	[MTD]
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index ac52bbc..1094952 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -60,7 +60,7 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
 void memblock_trim_memory(phys_addr_t align);
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
-extern struct movablecore_map movablecore_map;
+extern struct movablemem_map movablemem_map;
 
 void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
 			  unsigned long *out_end_pfn, int *out_nid);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1559e35..7cef651 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1359,15 +1359,15 @@ extern void free_bootmem_with_active_regions(int nid,
 						unsigned long max_low_pfn);
 extern void sparse_memory_present_with_active_regions(int nid);
 
-#define MOVABLECORE_MAP_MAX MAX_NUMNODES
-struct movablecore_entry {
+#define MOVABLEMEM_MAP_MAX MAX_NUMNODES
+struct movablemem_entry {
 	unsigned long start_pfn;    /* start pfn of memory segment */
 	unsigned long end_pfn;      /* end pfn of memory segment (exclusive) */
 };
 
-struct movablecore_map {
+struct movablemem_map {
 	int nr_map;
-	struct movablecore_entry map[MOVABLECORE_MAP_MAX];
+	struct movablemem_entry map[MOVABLEMEM_MAP_MAX];
 };
 
 #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
diff --git a/mm/memblock.c b/mm/memblock.c
index 0218231..c47ddd5 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -105,7 +105,7 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
 {
 	phys_addr_t this_start, this_end, cand;
 	u64 i;
-	int curr = movablecore_map.nr_map - 1;
+	int curr = movablemem_map.nr_map - 1;
 
 	/* pump up @end */
 	if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
@@ -124,15 +124,15 @@ restart:
 			continue;
 
 		for (; curr >= 0; curr--) {
-			if ((movablecore_map.map[curr].start_pfn << PAGE_SHIFT)
+			if ((movablemem_map.map[curr].start_pfn << PAGE_SHIFT)
 			    < this_end)
 				break;
 		}
 
 		cand = round_down(this_end - size, align);
 		if (curr >= 0 &&
-		    cand < movablecore_map.map[curr].end_pfn << PAGE_SHIFT) {
-			this_end = movablecore_map.map[curr].start_pfn
+		    cand < movablemem_map.map[curr].end_pfn << PAGE_SHIFT) {
+			this_end = movablemem_map.map[curr].start_pfn
 				   << PAGE_SHIFT;
 			goto restart;
 		}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2bd529e..3978797 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -202,7 +202,7 @@ static unsigned long __meminitdata dma_reserve;
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 /* Movable memory ranges, will also be used by memblock subsystem. */
-struct movablecore_map movablecore_map;
+struct movablemem_map movablemem_map;
 
 static unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
 static unsigned long __meminitdata arch_zone_highest_possible_pfn[MAX_NR_ZONES];
@@ -4375,7 +4375,7 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid,
  * sanitize_zone_movable_limit() - Sanitize the zone_movable_limit array.
  *
  * zone_movable_limit is initialized as 0. This function will try to get
- * the first ZONE_MOVABLE pfn of each node from movablecore_map, and
+ * the first ZONE_MOVABLE pfn of each node from movablemem_map, and
  * assigne them to zone_movable_limit.
  * zone_movable_limit[nid] == 0 means no limit for the node.
  *
@@ -4386,7 +4386,7 @@ static void __meminit sanitize_zone_movable_limit(void)
 	int map_pos = 0, i, nid;
 	unsigned long start_pfn, end_pfn;
 
-	if (!movablecore_map.nr_map)
+	if (!movablemem_map.nr_map)
 		return;
 
 	/* Iterate all ranges from minimum to maximum */
@@ -4420,22 +4420,22 @@ static void __meminit sanitize_zone_movable_limit(void)
 		if (start_pfn >= end_pfn)
 			continue;
 
-		while (map_pos < movablecore_map.nr_map) {
-			if (end_pfn <= movablecore_map.map[map_pos].start_pfn)
+		while (map_pos < movablemem_map.nr_map) {
+			if (end_pfn <= movablemem_map.map[map_pos].start_pfn)
 				break;
 
-			if (start_pfn >= movablecore_map.map[map_pos].end_pfn) {
+			if (start_pfn >= movablemem_map.map[map_pos].end_pfn) {
 				map_pos++;
 				continue;
 			}
 
 			/*
 			 * The start_pfn of ZONE_MOVABLE is either the minimum
-			 * pfn specified by movablecore_map, or 0, which means
+			 * pfn specified by movablemem_map, or 0, which means
 			 * the node has no ZONE_MOVABLE.
 			 */
 			zone_movable_limit[nid] = max(start_pfn,
-					movablecore_map.map[map_pos].start_pfn);
+					movablemem_map.map[map_pos].start_pfn);
 
 			break;
 		}
@@ -4898,12 +4898,12 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 	}
 
 	/*
-	 * If neither kernelcore/movablecore nor movablecore_map is specified,
-	 * there is no ZONE_MOVABLE. But if movablecore_map is specified, the
+	 * If neither kernelcore/movablecore nor movablemem_map is specified,
+	 * there is no ZONE_MOVABLE. But if movablemem_map is specified, the
 	 * start pfn of ZONE_MOVABLE has been stored in zone_movable_limit[].
 	 */
 	if (!required_kernelcore) {
-		if (movablecore_map.nr_map)
+		if (movablemem_map.nr_map)
 			memcpy(zone_movable_pfn, zone_movable_limit,
 				sizeof(zone_movable_pfn));
 		goto out;
@@ -5168,14 +5168,14 @@ early_param("kernelcore", cmdline_parse_kernelcore);
 early_param("movablecore", cmdline_parse_movablecore);
 
 /**
- * insert_movablecore_map() - Insert a memory range in to movablecore_map.map.
+ * insert_movablemem_map() - Insert a memory range in to movablemem_map.map.
  * @start_pfn:	start pfn of the range
  * @end_pfn:	end pfn of the range
  *
  * This function will also merge the overlapped ranges, and sort the array
  * by start_pfn in monotonic increasing order.
  */
-static void __init insert_movablecore_map(unsigned long start_pfn,
+static void __init insert_movablemem_map(unsigned long start_pfn,
 					  unsigned long end_pfn)
 {
 	int pos, overlap;
@@ -5184,31 +5184,31 @@ static void __init insert_movablecore_map(unsigned long start_pfn,
 	 * pos will be at the 1st overlapped range, or the position
 	 * where the element should be inserted.
 	 */
-	for (pos = 0; pos < movablecore_map.nr_map; pos++)
-		if (start_pfn <= movablecore_map.map[pos].end_pfn)
+	for (pos = 0; pos < movablemem_map.nr_map; pos++)
+		if (start_pfn <= movablemem_map.map[pos].end_pfn)
 			break;
 
 	/* If there is no overlapped range, just insert the element. */
-	if (pos == movablecore_map.nr_map ||
-	    end_pfn < movablecore_map.map[pos].start_pfn) {
+	if (pos == movablemem_map.nr_map ||
+	    end_pfn < movablemem_map.map[pos].start_pfn) {
 		/*
 		 * If pos is not the end of array, we need to move all
 		 * the rest elements backward.
 		 */
-		if (pos < movablecore_map.nr_map)
-			memmove(&movablecore_map.map[pos+1],
-				&movablecore_map.map[pos],
-				sizeof(struct movablecore_entry) *
-				(movablecore_map.nr_map - pos));
-		movablecore_map.map[pos].start_pfn = start_pfn;
-		movablecore_map.map[pos].end_pfn = end_pfn;
-		movablecore_map.nr_map++;
+		if (pos < movablemem_map.nr_map)
+			memmove(&movablemem_map.map[pos+1],
+				&movablemem_map.map[pos],
+				sizeof(struct movablemem_entry) *
+				(movablemem_map.nr_map - pos));
+		movablemem_map.map[pos].start_pfn = start_pfn;
+		movablemem_map.map[pos].end_pfn = end_pfn;
+		movablemem_map.nr_map++;
 		return;
 	}
 
 	/* overlap will be at the last overlapped range */
-	for (overlap = pos + 1; overlap < movablecore_map.nr_map; overlap++)
-		if (end_pfn < movablecore_map.map[overlap].start_pfn)
+	for (overlap = pos + 1; overlap < movablemem_map.nr_map; overlap++)
+		if (end_pfn < movablemem_map.map[overlap].start_pfn)
 			break;
 
 	/*
@@ -5216,29 +5216,29 @@ static void __init insert_movablecore_map(unsigned long start_pfn,
 	 * and move the rest elements forward.
 	 */
 	overlap--;
-	movablecore_map.map[pos].start_pfn = min(start_pfn,
-					movablecore_map.map[pos].start_pfn);
-	movablecore_map.map[pos].end_pfn = max(end_pfn,
-					movablecore_map.map[overlap].end_pfn);
+	movablemem_map.map[pos].start_pfn = min(start_pfn,
+					movablemem_map.map[pos].start_pfn);
+	movablemem_map.map[pos].end_pfn = max(end_pfn,
+					movablemem_map.map[overlap].end_pfn);
 
-	if (pos != overlap && overlap + 1 != movablecore_map.nr_map)
-		memmove(&movablecore_map.map[pos+1],
-			&movablecore_map.map[overlap+1],
-			sizeof(struct movablecore_entry) *
-			(movablecore_map.nr_map - overlap - 1));
+	if (pos != overlap && overlap + 1 != movablemem_map.nr_map)
+		memmove(&movablemem_map.map[pos+1],
+			&movablemem_map.map[overlap+1],
+			sizeof(struct movablemem_entry) *
+			(movablemem_map.nr_map - overlap - 1));
 
-	movablecore_map.nr_map -= overlap - pos;
+	movablemem_map.nr_map -= overlap - pos;
 }
 
 /**
- * movablecore_map_add_region() - Add a memory range into movablecore_map.
+ * movablemem_map_add_region() - Add a memory range into movablemem_map.
  * @start:	physical start address of range
  * @end:	physical end address of range
  *
  * This function transform the physical address into pfn, and then add the
- * range into movablecore_map by calling insert_movablecore_map().
+ * range into movablemem_map by calling insert_movablemem_map().
  */
-static void __init movablecore_map_add_region(u64 start, u64 size)
+static void __init movablemem_map_add_region(u64 start, u64 size)
 {
 	unsigned long start_pfn, end_pfn;
 
@@ -5246,8 +5246,8 @@ static void __init movablecore_map_add_region(u64 start, u64 size)
 	if (start + size <= start)
 		return;
 
-	if (movablecore_map.nr_map >= ARRAY_SIZE(movablecore_map.map)) {
-		pr_err("movable_memory_map: too many entries;"
+	if (movablemem_map.nr_map >= ARRAY_SIZE(movablemem_map.map)) {
+		pr_err("movablemem_map: too many entries;"
 			" ignoring [mem %#010llx-%#010llx]\n",
 			(unsigned long long) start,
 			(unsigned long long) (start + size - 1));
@@ -5256,19 +5256,19 @@ static void __init movablecore_map_add_region(u64 start, u64 size)
 
 	start_pfn = PFN_DOWN(start);
 	end_pfn = PFN_UP(start + size);
-	insert_movablecore_map(start_pfn, end_pfn);
+	insert_movablemem_map(start_pfn, end_pfn);
 }
 
 /*
- * cmdline_parse_movablecore_map() - Parse boot option movablecore_map.
+ * cmdline_parse_movablemem_map() - Parse boot option movablemem_map.
  * @p:	The boot option of the following format:
- * 	movablecore_map=nn[KMG]@ss[KMG]
+ * 	movablemem_map=nn[KMG]@ss[KMG]
  *
  * This option sets the memory range [ss, ss+nn) to be used as movable memory.
  *
  * Return: 0 on success or -EINVAL on failure.
  */
-static int __init cmdline_parse_movablecore_map(char *p)
+static int __init cmdline_parse_movablemem_map(char *p)
 {
 	char *oldp;
 	u64 start_at, mem_size;
@@ -5287,13 +5287,13 @@ static int __init cmdline_parse_movablecore_map(char *p)
 		if (p == oldp || *p != '\0')
 			goto err;
 
-		movablecore_map_add_region(start_at, mem_size);
+		movablemem_map_add_region(start_at, mem_size);
 		return 0;
 	}
 err:
 	return -EINVAL;
 }
-early_param("movablecore_map", cmdline_parse_movablecore_map);
+early_param("movablemem_map", cmdline_parse_movablemem_map);
 
 #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-22 11:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-22 11:46 [PATCH Bug fix 0/4] Bug fix for movablecore_map boot option Tang Chen
2013-01-22 11:46 ` [PATCH Bug fix 1/4] Bug fix: Use CONFIG_HAVE_MEMBLOCK_NODE_MAP to protect movablecore_map in memblock_overlaps_region() Tang Chen
2013-01-22 11:46 ` [PATCH Bug fix 2/4] Bug fix: Fix the doc format Tang Chen
2013-01-22 11:46 ` [PATCH Bug fix 3/4] Bug fix: Remove the unused sanitize_zone_movable_limit() definition Tang Chen
2013-01-22 11:46 ` [PATCH Bug fix 4/4] Rename movablecore_map to movablemem_map Tang Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).