From: David Laight <David.Laight@ACULAB.COM>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"'linux-sctp@vger.kernel.org'" <linux-sctp@vger.kernel.org>,
Eric Biggers <ebiggers@kernel.org>,
'Marcelo Ricardo Leitner' <marcelo.leitner@gmail.com>,
'Catalin Marinas' <catalin.marinas@arm.com>,
"'kent.overstreet@gmail.com'" <kent.overstreet@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
"'Neil Horman'" <nhorman@tuxdriver.com>
Subject: [PATCH 13/13] lib/generic-radix-tree: Simplify __genradix_ptr()
Date: Tue, 25 Aug 2020 14:52:38 +0000 [thread overview]
Message-ID: <35b7ab36369249d8bf17a04f58a0f337@AcuMS.aculab.com> (raw)
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@aculab.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)
reply other threads:[~2020-08-25 14:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35b7ab36369249d8bf17a04f58a0f337@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=ebiggers@kernel.org \
--cc=kent.overstreet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=nhorman@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®