Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1659862
| From | Matthew Wilcox <willy@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/3] bitmap: Use memcmp optimisation in more situations |
| Date | 2017-06-07 16:40 +0200 |
| Message-ID | <tPKhR-7Rr-43@gated-at.bofh.it> (permalink) |
| References | <tPK8a-7Mn-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Matthew Wilcox <mawilcox@microsoft.com>
Commit 7dd968163f ("bitmap: bitmap_equal memcmp optimization") was
rather more restrictive than necessary; we can use memcmp() to implement
bitmap_equal() as long as the number of bits can be proved to be a
multiple of 8. And architectures other than s390 may be able to make
good use of this optimisation.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
include/linux/bitmap.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 0b3e4452b054..26244e0098f0 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -266,10 +266,8 @@ static inline int bitmap_equal(const unsigned long *src1,
{
if (small_const_nbits(nbits))
return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
-#ifdef CONFIG_S390
- if (__builtin_constant_p(nbits) && (nbits % BITS_PER_LONG) == 0)
+ if (__builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
return !memcmp(src1, src2, nbits / 8);
-#endif
return __bitmap_equal(src1, src2, nbits);
}
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] Bitmap optimisations Matthew Wilcox <willy@infradead.org> - 2017-06-07 16:40 +0200
[PATCH 1/3] bitmap: Optimise bitmap_set and bitmap_clear of a single bit Matthew Wilcox <willy@infradead.org> - 2017-06-07 16:40 +0200
[PATCH 3/3] bitmap: Use memcmp optimisation in more situations Matthew Wilcox <willy@infradead.org> - 2017-06-07 16:40 +0200
Re: [PATCH 3/3] bitmap: Use memcmp optimisation in more situations Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 03:50 +0200
Re: [PATCH 3/3] bitmap: Use memcmp optimisation in more situations Matthew Wilcox <willy@infradead.org> - 2017-06-08 05:00 +0200
Re: [PATCH 3/3] bitmap: Use memcmp optimisation in more situations Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 14:40 +0200
Re: [PATCH 3/3] bitmap: Use memcmp optimisation in more situations Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2017-06-08 15:50 +0200
Re: [PATCH 3/3] bitmap: Use memcmp optimisation in more situations Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 16:50 +0200
Re: [PATCH 0/3] Bitmap optimisations Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2017-06-07 23:40 +0200
csiph-web