From: Matthew Wilcox <willy@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Matthew Wilcox <mawilcox@microsoft.com>
Subject: [PATCH v2 1/4] test_bitmap: Add optimisation tests
Date: Wed, 28 Jun 2017 08:32:18 -0700 [thread overview]
Message-ID: <20170628153221.11322-2-willy@infradead.org> (raw)
In-Reply-To: <20170628153221.11322-1-willy@infradead.org>
From: Matthew Wilcox <mawilcox@microsoft.com>
This version of the test is actually a no-op; the next patch will
enable it.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
lib/test_bitmap.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index e2cbd43d193c..252d3bddbe7d 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -333,10 +333,42 @@ 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);
+ DECLARE_BITMAP(bmap2, 1024);
+ unsigned int start, nbits;
+
+ for (start = 0; start < 1024; start += 8) {
+ memset(bmap1, 0x5a, sizeof(bmap1));
+ memset(bmap2, 0x5a, sizeof(bmap2));
+ for (nbits = 0; nbits < 1024 - start; nbits += 8) {
+ bitmap_set(bmap1, start, nbits);
+ __bitmap_set(bmap2, start, nbits);
+ if (!bitmap_equal(bmap1, bmap2, 1024))
+ printk("set not equal %d %d\n", start, nbits);
+ if (!__bitmap_equal(bmap1, bmap2, 1024))
+ printk("set not __equal %d %d\n", start, nbits);
+
+ bitmap_clear(bmap1, start, nbits);
+ __bitmap_clear(bmap2, start, nbits);
+ if (!bitmap_equal(bmap1, bmap2, 1024))
+ printk("clear not equal %d %d\n", start, nbits);
+ if (!__bitmap_equal(bmap1, bmap2, 1024))
+ printk("clear not __equal %d %d\n", start,
+ nbits);
+ }
+ }
+}
+
static int __init test_bitmap_init(void)
{
test_zero_fill_copy();
test_bitmap_u32_array_conversions();
+ test_mem_optimisations();
if (failed_tests == 0)
pr_info("all %u tests passed\n", total_tests);
--
2.11.0
next prev parent reply other threads:[~2017-06-28 15:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 15:32 [PATCH v2 0/4] Bitmap optimisations Matthew Wilcox
2017-06-28 15:32 ` Matthew Wilcox [this message]
2017-06-28 15:32 ` [PATCH v2 2/4] bitmap: Optimise bitmap_set and bitmap_clear of a single bit Matthew Wilcox
2017-06-28 15:32 ` [PATCH v2 3/4] Turn bitmap_set and bitmap_clear into memset when possible Matthew Wilcox
2017-06-28 15:32 ` [PATCH v2 4/4] bitmap: Use memcmp optimisation in more situations Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170628153221.11322-2-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mawilcox@microsoft.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.