linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] mm/memblock: reduce overhead in binary search
@ 2012-08-26  9:00 Wanpeng Li
  2012-08-26  9:00 ` [PATCH v2 2/4] mm/memblock: rename get_allocated_memblock_reserved_regions_info() Wanpeng Li
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wanpeng Li @ 2012-08-26  9:00 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Michal Hocko, KAMEZAWA Hiroyuki,
	Minchan Kim, Gavin Shan, Wanpeng Li

"v1 -> v2": 
* move check from memblock_search to memblock_is_memory
* modify changelog

When checking the indicated address belongs to the memory region, the 
memory regions are checked one by one through binary search, which would 
be a little time consuming. If the indicated address isn't in memory 
region, then we needn't do the time-sonsuming search. The patch adds
more check on the indicated address for that purpose.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/memblock.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 4d9393c..258e81d 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -888,6 +888,11 @@ int __init memblock_is_reserved(phys_addr_t addr)
 
 int __init_memblock memblock_is_memory(phys_addr_t addr)
 {
+
+	if (unlikely(addr < memblock_start_of_DRAM() ||
+		addr >= memblock_end_of_DRAM()))
+		return 0;
+
 	return memblock_search(&memblock.memory, addr) != -1;
 }
 
-- 
1.7.5.4


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

* [PATCH v2 2/4] mm/memblock: rename get_allocated_memblock_reserved_regions_info()
  2012-08-26  9:00 [PATCH v2 1/4] mm/memblock: reduce overhead in binary search Wanpeng Li
@ 2012-08-26  9:00 ` Wanpeng Li
  2012-08-26  9:00 ` [PATCH v2 3/4] mm/memblock: use existing interface to set nid Wanpeng Li
  2012-08-26  9:00 ` [PATCH v2 4/4] mm/memblock: cleanup early_node_map[] related comments Wanpeng Li
  2 siblings, 0 replies; 4+ messages in thread
From: Wanpeng Li @ 2012-08-26  9:00 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Michal Hocko, KAMEZAWA Hiroyuki,
	Minchan Kim, Gavin Shan, Wanpeng Li

From: Wanpeng Li <liwanp@linux.vnet.ibm.com>

Rename get_allocated_memblock_reserved_regions_info() to
memblock_reserved_regions_info() so that the function name
looks more short and has prefix "memblock".

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 include/linux/memblock.h |    2 +-
 mm/memblock.c            |    2 +-
 mm/nobootmem.c           |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 569d67d..ab7b887 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -50,7 +50,7 @@ phys_addr_t 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 memblock_find_in_range(phys_addr_t start, phys_addr_t end,
 				   phys_addr_t size, phys_addr_t align);
-phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr);
+phys_addr_t memblock_reserved_regions_info(phys_addr_t *addr);
 void memblock_allow_resize(void);
 int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
 int memblock_add(phys_addr_t base, phys_addr_t size);
diff --git a/mm/memblock.c b/mm/memblock.c
index c1fbb12..2feff8d 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -160,7 +160,7 @@ static void __init_memblock memblock_remove_region(struct memblock_type *type, u
 	}
 }
 
-phys_addr_t __init_memblock get_allocated_memblock_reserved_regions_info(
+phys_addr_t __init_memblock memblock_reserved_regions_info(
 					phys_addr_t *addr)
 {
 	if (memblock.reserved.regions == memblock_reserved_init_regions)
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index bd82f6b..7e95953 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -130,7 +130,7 @@ unsigned long __init free_low_memory_core_early(int nodeid)
 		count += __free_memory_core(start, end);
 
 	/* free range that is used for reserved array if we allocate it */
-	size = get_allocated_memblock_reserved_regions_info(&start);
+	size = memblock_reserved_regions_info(&start);
 	if (size)
 		count += __free_memory_core(start, start + size);
 
-- 
1.7.5.4


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

* [PATCH v2 3/4] mm/memblock: use existing interface to set nid
  2012-08-26  9:00 [PATCH v2 1/4] mm/memblock: reduce overhead in binary search Wanpeng Li
  2012-08-26  9:00 ` [PATCH v2 2/4] mm/memblock: rename get_allocated_memblock_reserved_regions_info() Wanpeng Li
@ 2012-08-26  9:00 ` Wanpeng Li
  2012-08-26  9:00 ` [PATCH v2 4/4] mm/memblock: cleanup early_node_map[] related comments Wanpeng Li
  2 siblings, 0 replies; 4+ messages in thread
From: Wanpeng Li @ 2012-08-26  9:00 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Michal Hocko, KAMEZAWA Hiroyuki,
	Minchan Kim, Gavin Shan, Wanpeng Li

From: Wanpeng Li <liwanp@linux.vnet.ibm.com>

Use existing interface (function) to set NUMA node ID (NID) for
the regions, either memory or reserved region.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/memblock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 880e461..3620493 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -756,7 +756,7 @@ int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size,
 		return ret;
 
 	for (i = start_rgn; i < end_rgn; i++)
-		type->regions[i].nid = nid;
+		memblock_set_region_node(&type->regions[i], nid);
 
 	memblock_merge_regions(type);
 	return 0;
-- 
1.7.5.4


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

* [PATCH v2 4/4] mm/memblock: cleanup early_node_map[] related comments
  2012-08-26  9:00 [PATCH v2 1/4] mm/memblock: reduce overhead in binary search Wanpeng Li
  2012-08-26  9:00 ` [PATCH v2 2/4] mm/memblock: rename get_allocated_memblock_reserved_regions_info() Wanpeng Li
  2012-08-26  9:00 ` [PATCH v2 3/4] mm/memblock: use existing interface to set nid Wanpeng Li
@ 2012-08-26  9:00 ` Wanpeng Li
  2 siblings, 0 replies; 4+ messages in thread
From: Wanpeng Li @ 2012-08-26  9:00 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Michal Hocko, KAMEZAWA Hiroyuki,
	Minchan Kim, Gavin Shan, Wanpeng Li

From: Wanpeng Li <liwanp@linux.vnet.ibm.com>

Commit 0ee332c14518699 ("memblock: Kill early_node_map[]") removed
early_node_map[], the patch does cleanup on comments to comply with
that change.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 include/linux/memblock.h |    3 +--
 mm/nobootmem.c           |    2 --
 mm/page_alloc.c          |    2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index d3d53aa..ab7b887 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -70,8 +70,7 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
  * @p_end: ptr to ulong for end pfn of the range, can be %NULL
  * @p_nid: ptr to int for nid of the range, can be %NULL
  *
- * Walks over configured memory ranges.  Available after early_node_map is
- * populated.
+ * Walks over configured memory ranges.
  */
 #define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid)		\
 	for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index 8ec48484..7e95953 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -162,8 +162,6 @@ unsigned long __init free_all_bootmem(void)
 	 * We need to use MAX_NUMNODES instead of NODE_DATA(0)->node_id
 	 *  because in some case like Node0 doesn't have RAM installed
 	 *  low ram will be on Node1
-	 * Use MAX_NUMNODES will make sure all ranges in early_node_map[]
-	 *  will be used instead of only Node0 related
 	 */
 	return free_low_memory_core_early(MAX_NUMNODES);
 }
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 009ac28..c1e2949 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4873,7 +4873,7 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)
 			       zone_movable_pfn[i] << PAGE_SHIFT);
 	}
 
-	/* Print out the early_node_map[] */
+	/* Print out the early node map */
 	printk("Early memory node ranges\n");
 	for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid)
 		printk("  node %3d: [mem %#010lx-%#010lx]\n", nid,
-- 
1.7.7.6


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

end of thread, other threads:[~2012-08-26  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-26  9:00 [PATCH v2 1/4] mm/memblock: reduce overhead in binary search Wanpeng Li
2012-08-26  9:00 ` [PATCH v2 2/4] mm/memblock: rename get_allocated_memblock_reserved_regions_info() Wanpeng Li
2012-08-26  9:00 ` [PATCH v2 3/4] mm/memblock: use existing interface to set nid Wanpeng Li
2012-08-26  9:00 ` [PATCH v2 4/4] mm/memblock: cleanup early_node_map[] related comments Wanpeng Li

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).