projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0455c74
)
lib/bitmap.c: micro-optimization for __bitmap_complement()
author
Yury Norov
<
[email protected]
>
Fri, 8 Jun 2018 00:10:41 +0000
(17:10 -0700)
committer
Linus Torvalds
<
[email protected]
>
Fri, 8 Jun 2018 00:34:39 +0000
(17:34 -0700)
Use BITS_TO_LONGS() macro to avoid calculation of reminder (bits %
BITS_PER_LONG) On ARM64 it saves 5 instruction for function - 16 before
and 11 after.
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Yury Norov <
[email protected]
>
Reviewed-by: Andrew Morton <
[email protected]
>
Cc: Matthew Wilcox <
[email protected]
>
Cc: Rasmus Villemoes <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
lib/bitmap.c
patch
|
blob
|
history
diff --git
a/lib/bitmap.c
b/lib/bitmap.c
index a42eff7e8c48bd81dd3db841a1e04f1672980b91..58f9750e49c6867d7e26ab00ef28c62966168461 100644
(file)
--- a/
lib/bitmap.c
+++ b/
lib/bitmap.c
@@
-64,12
+64,9
@@
EXPORT_SYMBOL(__bitmap_equal);
void __bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned int bits)
{
- unsigned int k, lim =
bits/BITS_PER_LONG
;
+ unsigned int k, lim =
BITS_TO_LONGS(bits)
;
for (k = 0; k < lim; ++k)
dst[k] = ~src[k];
-
- if (bits % BITS_PER_LONG)
- dst[k] = ~src[k];
}
EXPORT_SYMBOL(__bitmap_complement);