From: Yury Norov <yury.norov@gmail.com>
To: Richard Fontana <rfontana@redhat.com>,
Allison Randal <allison@lohutok.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Armijn Hemel <armijn@tjaldur.nl>,
Yury Norov <yury.norov@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH] lib/radix-tree.c: use generic find_next_bit()
Date: Fri, 3 Jan 2020 20:24:08 -0800 [thread overview]
Message-ID: <20200104042408.11346-1-yury.norov@gmail.com> (raw)
lib/radix-tree.c has its own version of find_next_bit(). This patch
switches it to generic one.
Testing with tools/testing/radix-tree shows no significant difference.
Before:
$ time ./main
random seed 1578108797
running tests
XArray: 21151073 of 21151073 tests passed
vvv Ignore these warnings
assertion failed at idr.c:269
assertion failed at idr.c:206
^^^ Warnings over
IDA: 39122827 of 39122827 tests passed
tests completed
real 1m28.290s
user 2m29.610s
sys 0m32.256s
yury:radix-tree$ mutt
4440 kept, 0 deleted.
After:
$ time ./main
random seed 1578108654
running tests
XArray: 21151073 of 21151073 tests passed
qvvv Ignore these warnings
assertion failed at idr.c:269
assertion failed at idr.c:206
^^^ Warnings over
IDA: 40991309 of 40991309 tests passed
tests completed
real 1m29.035s
user 2m31.481s
sys 0m33.006s
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
lib/radix-tree.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index c8fa1d2745302..23f86281133da 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -189,24 +189,7 @@ static __always_inline unsigned long
radix_tree_find_next_bit(struct radix_tree_node *node, unsigned int tag,
unsigned long offset)
{
- const unsigned long *addr = node->tags[tag];
-
- if (offset < RADIX_TREE_MAP_SIZE) {
- unsigned long tmp;
-
- addr += offset / BITS_PER_LONG;
- tmp = *addr >> (offset % BITS_PER_LONG);
- if (tmp)
- return __ffs(tmp) + offset;
- offset = (offset + BITS_PER_LONG) & ~(BITS_PER_LONG - 1);
- while (offset < RADIX_TREE_MAP_SIZE) {
- tmp = *++addr;
- if (tmp)
- return __ffs(tmp) + offset;
- offset += BITS_PER_LONG;
- }
- }
- return RADIX_TREE_MAP_SIZE;
+ return find_next_bit(node->tags[tag], RADIX_TREE_MAP_SIZE, offset);
}
static unsigned int iter_offset(const struct radix_tree_iter *iter)
--
2.20.1
reply other threads:[~2020-01-04 4:24 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=20200104042408.11346-1-yury.norov@gmail.com \
--to=yury.norov@gmail.com \
--cc=allison@lohutok.net \
--cc=armijn@tjaldur.nl \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rfontana@redhat.com \
--cc=tglx@linutronix.de \
--cc=willy@infradead.org \
/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®