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>] [day] [month] [year] [list]
Message-ID: <35b7ab36369249d8bf17a04f58a0f337@AcuMS.aculab.com>
Date:   Tue, 25 Aug 2020 14:52:38 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "'linux-sctp@...r.kernel.org'" <linux-sctp@...r.kernel.org>,
        Eric Biggers <ebiggers@...nel.org>,
        'Marcelo Ricardo Leitner' <marcelo.leitner@...il.com>,
        'Catalin Marinas' <catalin.marinas@....com>,
        "'kent.overstreet@...il.com'" <kent.overstreet@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "'Neil Horman'" <nhorman@...driver.com>
Subject: [PATCH 13/13] lib/generic-radix-tree: Simplify __genradix_ptr()

Now that requests for small trees are inlined there is no need
to aggressively optimise for them in __genradix_ptr().

Signed-off-by: David Laight <david.laight@...lab.com>
---
 lib/generic-radix-tree.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/generic-radix-tree.c b/lib/generic-radix-tree.c
index 7029a14eed97..497ac5effda0 100644
--- a/lib/generic-radix-tree.c
+++ b/lib/generic-radix-tree.c
@@ -45,9 +45,6 @@ void *__genradix_ptr(struct genradix_root *r, size_t offset)
 	unsigned int shift = __genradix_root_to_shift(r);
 	unsigned int idx;
 
-	if (likely(shift == GENRADIX_ROOT_SHIFT))
-		return offset < PAGE_SIZE ? n->data + offset : NULL;
-
 	if (unlikely(!shift))
 		return NULL;
 
@@ -56,13 +53,13 @@ void *__genradix_ptr(struct genradix_root *r, size_t offset)
 		return NULL;
 
 	for (;;) {
+		if (likely(shift == GENRADIX_ROOT_SHIFT))
+			return n->data + (offset % PAGE_SIZE);
+
 		n = READ_ONCE(n->children[idx]);
 		if (unlikely(!n))
 			return NULL;
 
-		if (shift == PAGE_SHIFT)
-			return n->data + (offset % PAGE_SIZE);
-
 		shift -= GENRADIX_ARY_SHIFT;
 		idx = (offset >> shift) % GENRADIX_ARY;
 	}
-- 
2.25.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ