diff options
author | Omar Sandoval <[email protected]> | 2018-04-02 15:58:31 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2018-04-02 20:52:27 -0700 |
commit | 21035965f60b0502fc6537b232839389bb4ce664 (patch) | |
tree | b4c969cd182d8e30dd9b0123c945f200ab50f14a /tools/perf/util/scripting-engines/trace-event-python.c | |
parent | f5a8eb632b562bd9c16c389f5db3a5260fba4157 (diff) |
bitmap: fix memset optimization on big-endian systems
Commit 2a98dc028f91 ("include/linux/bitmap.h: turn bitmap_set and
bitmap_clear into memset when possible") introduced an optimization to
bitmap_{set,clear}() which uses memset() when the start and length are
constants aligned to a byte.
This is wrong on big-endian systems; our bitmaps are arrays of unsigned
long, so bit n is not at byte n / 8 in memory. This was caught by the
Btrfs selftests, but the bitmap selftests also fail when run on a
big-endian machine.
We can still use memset if the start and length are aligned to an
unsigned long, so do that on big-endian. The same problem applies to
the memcmp in bitmap_equal(), so fix it there, too.
Fixes: 2a98dc028f91 ("include/linux/bitmap.h: turn bitmap_set and bitmap_clear into memset when possible")
Fixes: 2c6deb01525a ("bitmap: use memcmp optimisation in more situations")
Cc: [email protected]
Reported-by: "Erhard F." <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
0 files changed, 0 insertions, 0 deletions