Yury Norov
809e308f7f
lib: new testcases for bitmap_parse{_user}
...
New version of bitmap_parse() is unified with bitmap_parse_list(),
and therefore:
- weakens rules on whitespaces and commas between hex chunks;
- in addition to
- allows passing UINT_MAX or any other big number as the length of input
string instead of actual string length.
The patch covers the cases.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Reviewed-by: Andy Shevchenko <[email protected] >
Cc: Amritha Nambiar <[email protected] >
Cc: Arnaldo Carvalho de Melo <[email protected] >
Cc: Chris Wilson <[email protected] >
Cc: Kees Cook <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Miklos Szeredi <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Steffen Klassert <[email protected] >
Cc: "Tobin C . Harding" <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Willem de Bruijn <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2020-02-04 03:05:27 +00:00
Yury Norov
7eb2e94e96
lib: add test for bitmap_parse()
...
The test is derived from bitmap_parselist() NO_LEN is reserved for use in
following patches.
[[email protected] : fix rebase issue]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected] : fix address space when test user buffer]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Signed-off-by: Andy Shevchenko <[email protected] >
Reviewed-by: Andy Shevchenko <[email protected] >
Cc: Amritha Nambiar <[email protected] >
Cc: Arnaldo Carvalho de Melo <[email protected] >
Cc: Chris Wilson <[email protected] >
Cc: Kees Cook <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Miklos Szeredi <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Steffen Klassert <[email protected] >
Cc: "Tobin C . Harding" <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Willem de Bruijn <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2020-02-04 03:05:26 +00:00
Andy Shevchenko
69334ca530
lib/test_bitmap: correct test data offsets for 32-bit
...
On 32-bit platform the size of long is only 32 bits which makes wrong
offset in the array of 64 bit size.
Calculate offset based on BITS_PER_LONG.
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 30544ed5de ("lib/bitmap: introduce bitmap_replace() helper")
Signed-off-by: Andy Shevchenko <[email protected] >
Reported-by: Guenter Roeck <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Yury Norov <[email protected] >
Cc: <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2020-01-31 10:30:36 -08:00
Andy Shevchenko
30544ed5de
lib/bitmap: introduce bitmap_replace() helper
...
In some drivers we want to have a single operation over bitmap which is
an equivalent to:
*dst = (*old & ~(*mask)) | (*new & *mask)
Introduce bitmap_replace() helper for this.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Acked-by: Linus Walleij <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Marek Vasut <[email protected] >
Cc: Thomas Petazzoni <[email protected] >
Cc: William Breathitt Gray <[email protected] >
Cc: Yury Norov <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:14 -08:00
Andy Shevchenko
780ff33b8b
lib/test_bitmap: fix comment about this file
...
This test case file is about bitmap API, and not printf() facility.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Acked-by: Linus Walleij <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Marek Vasut <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Thomas Petazzoni <[email protected] >
Cc: William Breathitt Gray <[email protected] >
Cc: Yury Norov <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:14 -08:00
Andy Shevchenko
c21dd8a7bb
lib/test_bitmap: move exp1 and exp2 upper for others to use
...
Some test cases may re-use predefined exp1 and exp2 bitmaps. Move them
upper in the file.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Acked-by: Linus Walleij <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Marek Vasut <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Thomas Petazzoni <[email protected] >
Cc: William Breathitt Gray <[email protected] >
Cc: Yury Norov <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:14 -08:00
Andy Shevchenko
0ee312e380
lib/test_bitmap: rename exp to exp1 to avoid ambiguous name
...
One function is using exp as local variable. Avoid ambiguous naming by
rename global one to exp1.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Acked-by: Linus Walleij <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Marek Vasut <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Thomas Petazzoni <[email protected] >
Cc: William Breathitt Gray <[email protected] >
Cc: Yury Norov <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:14 -08:00
Andy Shevchenko
a4881d1cbc
lib/test_bitmap: name EXP_BYTES properly
...
EXP_BYTES has been wrongly named. It's a size of the exp array in bits.
While here, go ahead and rename to EXP1_IN_BITS to avoid double renaming
when exp will be renamed to exp1 in the next patch
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Acked-by: Linus Walleij <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Marek Vasut <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Thomas Petazzoni <[email protected] >
Cc: William Breathitt Gray <[email protected] >
Cc: Yury Norov <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:14 -08:00
Andy Shevchenko
5422404409
lib/test_bitmap: undefine macros after use
...
There is no need to keep step and ptest macros defined in entire file.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Acked-by: Linus Walleij <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Marek Vasut <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Thomas Petazzoni <[email protected] >
Cc: William Breathitt Gray <[email protected] >
Cc: Yury Norov <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:14 -08:00
Andy Shevchenko
17b6753ff0
lib/test_bitmap: force argument of bitmap_parselist_user() to proper address space
...
Patch series "gpio: pca953x: Convert to bitmap (extended) API", v2.
While converting gpio-pca953x driver to bitmap API, I noticed that we
have no function to replace bits.
So, that's how patch 7 appears.
First 6 patches are preparatory of the test suite (including some
warning fixes, etc).
Patches 8-9 are preparatory for the GPIO driver to be easier converted
to bitmap API, conversion to which happens in patch 10.
Patch 11 contains simple indentation fixes.
This patch (of 11):
Sparse complains:
lib/test_bitmap.c:345:58: warning: incorrect type in argument 1 (different address spaces)
lib/test_bitmap.c:345:58: expected char const [noderef] <asn:1> *ubuf
lib/test_bitmap.c:345:58: got char const *const in
Force argument of bitmap_parselist_user() to proper address space.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Acked-by: Linus Walleij <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Yury Norov <[email protected] >
Cc: William Breathitt Gray <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Thomas Petazzoni <[email protected] >
Cc: Marek Vasut <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:14 -08:00
William Breathitt Gray
e4aa168de8
lib/test_bitmap.c: add for_each_set_clump8 test cases
...
The introduction of the for_each_set_clump8 macro warrants test cases to
verify the implementation. This patch adds test case checks for whether
an out-of-bounds clump index is returned, a zero clump is returned, or
the returned clump value differs from the expected clump value.
Link: http://lkml.kernel.org/r/febc0fb8151e3e3fdd61c34da9193d1c4d7e6c12.1570641097.git.vilhelm.gray@gmail.com
Signed-off-by: William Breathitt Gray <[email protected] >
Reviewed-by: Andy Shevchenko <[email protected] >
Reviewed-by: Linus Walleij <[email protected] >
Tested-by: Andy Shevchenko <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Bartosz Golaszewski <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Lukas Wunner <[email protected] >
Cc: Masahiro Yamada <[email protected] >
Cc: Mathias Duckeck <[email protected] >
Cc: Morten Hein Tiljeset <[email protected] >
Cc: Phil Reid <[email protected] >
Cc: Sean Nyekjaer <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-12-04 19:44:12 -08:00
Thomas Gleixner
09c434b8a0
treewide: Add SPDX license identifier for more missed files
...
Add SPDX license identifiers to all files which:
- Have no license information of any form
- Have MODULE_LICENCE("GPL*") inside which was used in the initial
scan/conversion to ignore the file
These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:
GPL-2.0-only
Signed-off-by: Thomas Gleixner <[email protected] >
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2019-05-21 10:50:45 +02:00
Yury Norov
6ea86bdfc1
lib/test_bitmap: add tests for bitmap_parselist_user()
...
Propagate existing bitmap_parselist() tests to bitmap_parselist_user().
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Reviewed-by: Andy Shevchenko <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Kees Cook <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Mike Travis <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Tetsuo Handa <[email protected] >
Cc: Guenter Roeck <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-05-14 19:52:49 -07:00
Yury Norov
a4ab50509c
lib/test_bitmap: add testcases for bitmap_parselist()
...
Add tests for non-number character, empty regions, integer overflow.
[[email protected] : v5]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Reviewed-by: Andy Shevchenko <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Kees Cook <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Mike Travis <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Tetsuo Handa <[email protected] >
Cc: Guenter Roeck <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-05-14 19:52:49 -07:00
Yury Norov
0c2111a5c8
lib/test_bitmap: switch test_bitmap_parselist to ktime_get()
...
test_bitmap_parselist currently uses get_cycles which is not implemented
on some platforms, so use ktime_get() instead.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Reviewed-by: Andy Shevchenko <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Kees Cook <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Mike Travis <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Tetsuo Handa <[email protected] >
Cc: Guenter Roeck <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-05-14 19:52:49 -07:00
Tobin C. Harding
6b1a4d5b1a
lib: Use new kselftest header
...
We just added a new C header file for use with test modules that are
intended to be run with kselftest. We can reduce code duplication by
using this header.
Use new kselftest header to reduce code duplication in test_printf and
test_bitmap test modules.
Acked-by: Kees Cook <[email protected] >
Signed-off-by: Tobin C. Harding <[email protected] >
Signed-off-by: Shuah Khan <[email protected] >
2019-04-08 16:44:20 -06:00
Matthew Wilcox
1e3054b98c
lib/test_bitmap.c: fix bitmap optimisation tests to report errors correctly
...
I had neglected to increment the error counter when the tests failed,
which made the tests noisy when they fail, but not actually return an
error code.
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 3cc78125a0 ("lib/test_bitmap.c: add optimisation tests")
Signed-off-by: Matthew Wilcox <[email protected] >
Signed-off-by: Michael Ellerman <[email protected] >
Reported-by: Michael Ellerman <[email protected] >
Tested-by: Michael Ellerman <[email protected] >
Reviewed-by: Kees Cook <[email protected] >
Cc: Yury Norov <[email protected] >
Cc: Andy Shevchenko <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: <[email protected] > [4.13+]
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-05-18 17:17:12 -07:00
Kees Cook
f6f66c1bf5
lib/test_bitmap.c: do not accidentally use stack VLA
...
This avoids an accidental stack VLA (since the compiler thinks the value
of "len" can change, even when marked "const"). This just replaces it
with a #define so it will DTRT.
Seen with -Wvla. Fixed as part of the directive to remove all VLAs from
the kernel: https://lkml.org/lkml/2018/3/7/621
Link: http://lkml.kernel.org/r/20180307212555.GA17927@beast
Signed-off-by: Kees Cook <[email protected] >
Reviewed-by: Andrew Morton <[email protected] >
Cc: Yury Norov <[email protected] >
Cc: Andy Shevchenko <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-04-11 10:28:35 -07:00
Yury Norov
8351760ff5
lib: fix stall in __bitmap_parselist()
...
syzbot is catching stalls at __bitmap_parselist()
(https://syzkaller.appspot.com/bug?id=ad7e0351fbc90535558514a71cd3edc11681997a ).
The trigger is
unsigned long v = 0;
bitmap_parselist("7:,", &v, BITS_PER_LONG);
which results in hitting infinite loop at
while (a <= b) {
off = min(b - a + 1, used_size);
bitmap_set(maskp, a, off);
a += group_size;
}
due to used_size == group_size == 0.
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 0a5ce0831d ("lib/bitmap.c: make bitmap_parselist() thread-safe and much faster")
Signed-off-by: Yury Norov <[email protected] >
Reported-by: Tetsuo Handa <[email protected] >
Reported-by: syzbot <[email protected] >
Cc: Noam Camus <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Mauro Carvalho Chehab <[email protected] >
Cc: <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-04-05 21:36:21 -07:00
Andy Shevchenko
fe81814c3e
lib/test_bitmap.c: clean up test_zero_fill_copy() test case and rename
...
Since we have separate explicit test cases for bitmap_zero() /
bitmap_clear() and bitmap_fill() / bitmap_set(), clean up
test_zero_fill_copy() to only test bitmap_copy() functionality and thus
rename a function to reflect the changes.
While here, replace bitmap_fill() by bitmap_set() with proper values.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Reviewed-by: Yury Norov <[email protected] >
Cc: Randy Dunlap <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-02-06 18:32:44 -08:00
Andy Shevchenko
978f369c5c
lib/test_bitmap.c: add bitmap_fill()/bitmap_set() test cases
...
Explicitly test bitmap_fill() and bitmap_set() functions.
For bitmap_fill() we expect a consistent behaviour as in bitmap_zero(),
i.e. the trailing bits will be set up to unsigned long boundary.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Reviewed-by: Yury Norov <[email protected] >
Cc: Randy Dunlap <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-02-06 18:32:44 -08:00
Andy Shevchenko
ee3527bd5e
lib/test_bitmap.c: add bitmap_zero()/bitmap_clear() test cases
...
Explicitly test bitmap_zero() and bitmap_clear() functions.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Reviewed-by: Yury Norov <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Randy Dunlap <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-02-06 18:32:44 -08:00
Yury Norov
3aa56885e5
bitmap: replace bitmap_{from,to}_u32array
...
with bitmap_{from,to}_arr32 over the kernel. Additionally to it:
* __check_eq_bitmap() now takes single nbits argument.
* __check_eq_u32_array is not used in new test but may be used in
future. So I don't remove it here, but annotate as __used.
Tested on arm64 and 32-bit BE mips.
[[email protected] : perf: arm_dsu_pmu: convert to bitmap_from_arr32]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected] : fix net/core/ethtool.c]
Link: http://lkml.kernel.org/r/20180205071747.4ekxtsbgxkj5b2fz@yury-thinkpad
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Signed-off-by: Arnd Bergmann <[email protected] >
Cc: Ben Hutchings <[email protected] >
Cc: David Decotigny <[email protected] >,
Cc: David S. Miller <[email protected] >,
Cc: Geert Uytterhoeven <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Heiner Kallweit <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-02-06 18:32:44 -08:00
Geert Uytterhoeven
8185f5708d
lib/test_bitmap.c: use ULL suffix for 64-bit constants
...
With gcc 4.1.2:
lib/test_bitmap.c:189: warning: integer constant is too large for `long' type
lib/test_bitmap.c:190: warning: integer constant is too large for `long' type
lib/test_bitmap.c:194: warning: integer constant is too large for `long' type
lib/test_bitmap.c:195: warning: integer constant is too large for `long' type
Add the missing "ULL" suffix to fix this.
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 60ef690018 ("bitmap: introduce BITMAP_FROM_U64()")
Signed-off-by: Geert Uytterhoeven <[email protected] >
Acked-by: Yury Norov <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2017-09-13 18:53:15 -07:00
Yury Norov
60ef690018
bitmap: introduce BITMAP_FROM_U64()
...
The macro is the compile-time analogue of bitmap_from_u64() with the same
purpose: convert the 64-bit number to the properly ordered pair of 32-bit
parts, suitable for filling the bitmap in 32-bit BE environment.
Use it to make test_bitmap_parselist() correct for 32-bit BE ABIs.
Tested on BE mips/qemu.
[[email protected] : tweak code comment]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Cc: Noam Camus <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Mauro Carvalho Chehab <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2017-09-08 18:26:49 -07:00
Yury Norov
6df0d464db
lib/test_bitmap.c: add test for bitmap_parselist()
...
Do some basic checks for bitmap_parselist().
[[email protected] : fix printk warning]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected] >
Cc: Noam Camus <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Mauro Carvalho Chehab <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2017-09-08 18:26:49 -07:00
Matthew Wilcox
e5af323c9b
bitmap: optimise bitmap_set and bitmap_clear of a single bit
...
We have eight users calling bitmap_clear for a single bit and seventeen
calling bitmap_set for a single bit. Rather than fix all of them to
call __clear_bit or __set_bit, turn bitmap_clear and bitmap_set into
inline functions and make this special case efficient.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox <[email protected] >
Acked-by: Rasmus Villemoes <[email protected] >
Cc: Martin Schwidefsky <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2017-07-10 16:32:34 -07:00
Matthew Wilcox
3cc78125a0
lib/test_bitmap.c: add optimisation tests
...
Patch series "Bitmap optimisations", v2.
These three bitmap patches use more efficient specialisations when the
compiler can figure out that it's safe to do so. Thanks to Rasmus's
eagle eyes, a nasty bug in v1 was avoided, and I've added a test case
which would have caught it.
This patch (of 4):
This version of the test is actually a no-op; the next patch will enable
it.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox <[email protected] >
Cc: Rasmus Villemoes <[email protected] >
Cc: Martin Schwidefsky <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2017-07-10 16:32:34 -07:00
David Decotigny
5fd003f56c
test_bitmap: unit tests for lib/bitmap.c
...
This is mainly testing bitmap construction and conversion to/from u32[]
for now.
Tested:
qemu i386, x86_64, ppc, ppc64 BE and LE, ARM.
Signed-off-by: David Decotigny <[email protected] >
Signed-off-by: David S. Miller <[email protected] >
2016-02-19 22:54:09 -05:00