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

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