From: Christoph Lameter <cl@linux-foundation.org>
To: Mel Gorman <mel@csn.ul.ie>
Cc: linux-kernel@vger.kernel.org
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Tejun Heo <tj@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: akpm@linux-foundation.org
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Subject: [RFC In-kernel benchmarks 2/3] Vm statistics performance test
Date: Tue, 13 Oct 2009 16:02:35 -0400 [thread overview]
Message-ID: <20091013200302.344340423@gentwo.org> (raw)
In-Reply-To: <20091013200233.260324963@gentwo.org>
[-- Attachment #1: 0002-Vm-statistics-performance-test.patch --]
[-- Type: text/plain, Size: 3891 bytes --]
Tests the performance of some key vm statistics functions.
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
---
tests/Kconfig | 7 +++
tests/Makefile | 1
tests/vmstat_test.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 105 insertions(+)
create mode 100644 tests/vmstat_test.c
Index: linux-2.6/tests/Makefile
===================================================================
--- linux-2.6.orig/tests/Makefile 2009-10-12 15:13:04.000000000 -0500
+++ linux-2.6/tests/Makefile 2009-10-12 15:15:08.000000000 -0500
@@ -1,2 +1,3 @@
obj-$(CONFIG_BENCHMARK_SLAB) += slab_test.o
+obj-#(CONFIG_BENCHMARK_VMSTAT) += vmstat_test.o
Index: linux-2.6/tests/vmstat_test.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6/tests/vmstat_test.c 2009-10-12 15:15:08.000000000 -0500
@@ -0,0 +1,97 @@
+/* test-vmstat.c
+ *
+ * Test module for in kernel synthetic vm statistics performance.
+ *
+ * execute
+ *
+ * modprobe test-vmstat
+ *
+ * to run this test
+ *
+ * (C) 2009 Linux Foundation, Christoph Lameter <cl@linux-foundation.org>
+ */
+
+#include <linux/jiffies.h>
+#include <linux/compiler.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <asm/timex.h>
+#include <asm/system.h>
+
+#define TEST_COUNT 10000
+
+static int vmstat_test_init(void)
+{
+ unsigned int i;
+ cycles_t time1, time2, time;
+ int rem;
+ struct page *page = alloc_page(GFP_KERNEL);
+
+ printk(KERN_ALERT "VMstat testing\n");
+ printk(KERN_ALERT "=====================\n");
+ printk(KERN_ALERT "1. inc_zone_page_state() then dec_zone_page_state()\n");
+ time1 = get_cycles();
+ for (i = 0; i < TEST_COUNT; i++)
+ inc_zone_page_state(page, NR_BOUNCE);
+
+ time2 = get_cycles();
+ time = time2 - time1;
+
+ printk(KERN_ALERT "%i times inc_zone_page_state() ", i);
+ time = div_u64_rem(time, TEST_COUNT, &rem);
+ printk("-> %llu cycles ", time);
+
+ time1 = get_cycles();
+ for (i = 0; i < TEST_COUNT; i++)
+ __dec_zone_page_state(page, NR_BOUNCE);
+
+ time2 = get_cycles();
+ time = time2 - time1;
+
+ printk("__dec_z_p_s() ");
+ time = div_u64_rem(time, TEST_COUNT, &rem);
+ printk("-> %llu cycles\n", time);
+
+ printk(KERN_ALERT "2. inc_zone_page_state()/dec_zone_page_state()\n");
+ time1 = get_cycles();
+ for (i = 0; i < TEST_COUNT; i++) {
+ inc_zone_page_state(page, NR_BOUNCE);
+ dec_zone_page_state(page, NR_BOUNCE);
+ }
+
+ time2 = get_cycles();
+ time = time2 - time1;
+
+ printk(KERN_ALERT "%i times inc/dec ", i);
+ time = div_u64_rem(time, TEST_COUNT, &rem);
+ printk("-> %llu cycles\n", time);
+
+ printk(KERN_ALERT "3. count_vm_event()\n");
+ time1 = get_cycles();
+ for (i = 0; i < TEST_COUNT; i++)
+ count_vm_event(SLABS_SCANNED);
+
+ time2 = get_cycles();
+ time = time2 - time1;
+
+ count_vm_events(SLABS_SCANNED, -TEST_COUNT);
+ printk(KERN_ALERT "%i count_vm_events ", i);
+ time = div_u64_rem(time, TEST_COUNT, &rem);
+ printk("-> %llu cycles\n", time);
+ __free_page(page);
+ return -EAGAIN; /* Fail will directly unload the module */
+}
+
+static void vmstat_test_exit(void)
+{
+ printk(KERN_ALERT "test exit\n");
+}
+
+module_init(vmstat_test_init)
+module_exit(vmstat_test_exit)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christoph Lameter");
+MODULE_DESCRIPTION("VM statistics test");
+
Index: linux-2.6/tests/Kconfig
===================================================================
--- linux-2.6.orig/tests/Kconfig 2009-10-12 15:14:54.000000000 -0500
+++ linux-2.6/tests/Kconfig 2009-10-12 15:15:55.000000000 -0500
@@ -15,5 +15,12 @@ config BENCHMARK_SLAB
help
A benchmark that measures slab allocator performance.
+config BENCHMARK_VMSTAT
+ tristate "VM statistics Benchmark"
+ default m
+ depends on m
+ help
+ A benchmark measuring the performance of vm statistics.
+
endif # BENCHMARKS
--
next prev parent reply other threads:[~2009-10-13 20:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-13 20:02 [RFC In-kernel benchmarks 0/3] Introduce in kernel benchmarks Christoph Lameter
2009-10-13 20:02 ` [RFC In-kernel benchmarks 1/3] Add slab performance tests Christoph Lameter
2009-10-13 20:02 ` Christoph Lameter [this message]
2009-10-13 20:02 ` [RFC In-kernel benchmarks 3/3] Page allocator test Christoph Lameter
2009-10-15 8:09 ` [RFC In-kernel benchmarks 0/3] Introduce in kernel benchmarks David Rientjes
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=20091013200302.344340423@gentwo.org \
--to=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®