lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1345818820-12102-3-git-send-email-liwanp@linux.vnet.ibm.com>
Date:	Fri, 24 Aug 2012 22:33:38 +0800
From:	Wanpeng Li <liwanp@...ux.vnet.ibm.com>
To:	linux-mm@...ck.org
Cc:	linux-kernel@...r.kernel.org, Michal Hocko <mhocko@...e.cz>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Minchan Kim <minchan@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Gavin Shan <shangw@...ux.vnet.ibm.com>,
	Wanpeng Li <liwanp@...ux.vnet.ibm.com>
Subject: [PATCH 3/5] mm/memblock: reduce overhead in binary search

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

When checking the indicated address belongs to the memory
or reserved region, the memory or reserved 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@...ux.vnet.ibm.com>
---
 mm/memblock.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 2feff8d..880e461 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -871,6 +871,10 @@ static int __init_memblock memblock_search(struct memblock_type *type, phys_addr
 {
 	unsigned int left = 0, right = type->cnt;
 
+	if (unlikely(addr < memblock_start_of_DRAM() ||
+		addr >= memblock_end_of_DRAM()))
+			return 0;
+
 	do {
 		unsigned int mid = (right + left) / 2;
 
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ