summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2017-07-10 15:51:29 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-10 16:32:34 -0700
commite5af323c9badd5dc09af7ccf9d45616ebffc623c (patch)
treeda5f5087eb7c2eb2c5953bd34e5facc714de9d67 /lib
parent3cc78125a081bb79eb38f3e9a585e5a81bb81cb1 (diff)
downloadop-kernel-dev-e5af323c9badd5dc09af7ccf9d45616ebffc623c.zip
op-kernel-dev-e5af323c9badd5dc09af7ccf9d45616ebffc623c.tar.gz
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/20170628153221.11322-3-willy@infradead.org Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bitmap.c8
-rw-r--r--lib/test_bitmap.c3
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 08c6ef3..9a53280 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -251,7 +251,7 @@ int __bitmap_weight(const unsigned long *bitmap, unsigned int bits)
}
EXPORT_SYMBOL(__bitmap_weight);
-void bitmap_set(unsigned long *map, unsigned int start, int len)
+void __bitmap_set(unsigned long *map, unsigned int start, int len)
{
unsigned long *p = map + BIT_WORD(start);
const unsigned int size = start + len;
@@ -270,9 +270,9 @@ void bitmap_set(unsigned long *map, unsigned int start, int len)
*p |= mask_to_set;
}
}
-EXPORT_SYMBOL(bitmap_set);
+EXPORT_SYMBOL(__bitmap_set);
-void bitmap_clear(unsigned long *map, unsigned int start, int len)
+void __bitmap_clear(unsigned long *map, unsigned int start, int len)
{
unsigned long *p = map + BIT_WORD(start);
const unsigned int size = start + len;
@@ -291,7 +291,7 @@ void bitmap_clear(unsigned long *map, unsigned int start, int len)
*p &= ~mask_to_clear;
}
}
-EXPORT_SYMBOL(bitmap_clear);
+EXPORT_SYMBOL(__bitmap_clear);
/**
* bitmap_find_next_zero_area_off - find a contiguous aligned zero area
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 252d3bd..2526a29 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -333,9 +333,6 @@ static void __init test_bitmap_u32_array_conversions(void)
}
}
-#define __bitmap_set(a, b, c) bitmap_set(a, b, c)
-#define __bitmap_clear(a, b, c) bitmap_clear(a, b, c)
-
static void noinline __init test_mem_optimisations(void)
{
DECLARE_BITMAP(bmap1, 1024);
OpenPOWER on IntegriCloud