Skip to contentSkip to conversation

perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)

PATCH New Roman Penyaev 1 participant 3 messages Jan 3, 2019 perf events

lore
Share & tools
lore
#0 lore raw

cover perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)

The intention of a new benchmark is to measure events delivery
bandwidth: N threads produce events and 1 thread consumes events calling epoll_wait(2).

Benchmark does measurements for 8, 16, 32, 64 and 128 threads in a loop.

This one differs from epoll-wait in that it produces events from many threads and consumes from one, thus mp1c (many producers 1 consumer).

Roman Penyaev (2):
perf bench: rename epoll-wait bench to epoll-wait-1pmc perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)

 tools/perf/bench/Build                        |   3 +-
 tools/perf/bench/bench.h                      |   3 +-
 .../bench/{epoll-wait.c => epoll-wait-1pmc.c} |   6 +-
 tools/perf/bench/epoll-wait-mp1c.c            | 175 ++++++++++++++++++
 tools/perf/builtin-bench.c                    |   3 +-
 5 files changed, 186 insertions(+), 4 deletions(-)
 rename tools/perf/bench/{epoll-wait.c => epoll-wait-1pmc.c} (98%)
 create mode 100644 tools/perf/bench/epoll-wait-mp1c.c
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc Jason Baron <[email protected]>
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/2 perf bench: rename epoll-wait bench to epoll-wait-1pmc

I want to rename this in order to add another epoll-wait bench in next patch and to stress in the name, that the bench corresponds to 1 producer and many consumers.

In the following patch I plan to add epoll-wait-mp1c bench.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc Jason Baron <[email protected]>
---
 tools/perf/bench/Build                               | 2 +-
 tools/perf/bench/bench.h                             | 2 +-
 tools/perf/bench/{epoll-wait.c => epoll-wait-1pmc.c} | 6 +++++-
 tools/perf/builtin-bench.c                           | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename tools/perf/bench/{epoll-wait.c => epoll-wait-1pmc.c} (98%)
tools/perf/bench/Build +1 -1
index e4e321b6f883..ef07fc40bc35 100644
@@ -7,7 +7,7 @@ perf-y += futex-wake-parallel.o
 perf-y += futex-requeue.o
 perf-y += futex-lock-pi.o
 
-perf-y += epoll-wait.o
+perf-y += epoll-wait-1pmc.o
 perf-y += epoll-ctl.o
 
 perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-lib.o
tools/perf/bench/bench.h +1 -1
index fddb3ced9db6..fb9782624644 100644
@@ -38,7 +38,7 @@ int bench_futex_requeue(int argc, const char **argv);
 /* pi futexes */
 int bench_futex_lock_pi(int argc, const char **argv);
 
-int bench_epoll_wait(int argc, const char **argv);
+int bench_epoll_wait_1pmc(int argc, const char **argv);
 int bench_epoll_ctl(int argc, const char **argv);
 
 #define BENCH_FORMAT_DEFAULT_STR	"default"
tools/perf/bench/epoll-wait-1pmc.c renamed from tools/perf/bench/epoll-wait.c +5 -1
similarity index 98%
rename from tools/perf/bench/epoll-wait.c
rename to tools/perf/bench/epoll-wait-1pmc.c
index 5a11534e96a0..1b88cdd2ef78 100644
@@ -26,6 +26,10 @@
  *             [queue D]  ---> [worker]
  *             [queue E]  ---> [worker]
  *
+ * Both models correspond to 1 producer and many consumers, where a single
+ * producer is a writer thread and consumers are many workers threads
+ * waiting for events.
+ *
  * Naturally, the single queue will enforce more concurrency on the epoll
  * instance, and can therefore scale poorly compared to multiple queues.
  * However, this is a benchmark raw data and must be taken with a grain of
@@ -409,7 +413,7 @@ static int cmpworker(const void *p1, const void *p2)
 	return w1->tid > w2->tid;
 }
 
-int bench_epoll_wait(int argc, const char **argv)
+int bench_epoll_wait_1pmc(int argc, const char **argv)
 {
 	int ret = 0;
 	struct sigaction act;
tools/perf/builtin-bench.c +1 -1
index 334c77ffc1d9..6926b5a5eebf 100644
@@ -70,7 +70,7 @@ static struct bench futex_benchmarks[] = {
 
 #ifdef HAVE_EVENTFD
 static struct bench epoll_benchmarks[] = {
-	{ "wait",	"Benchmark epoll concurrent epoll_waits",       bench_epoll_wait	},
+	{ "wait-1pmc",	"Benchmark epoll concurrent epoll_waits",       bench_epoll_wait_1pmc	},
 	{ "ctl",	"Benchmark epoll concurrent epoll_ctls",        bench_epoll_ctl		},
 	{ "all",	"Run all futex benchmarks",			NULL			},
 	{ NULL,		NULL,						NULL			}
Signature · 1 line
2.19.1
#2 lore raw

PATCH 2/2 perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)

In reply to Roman Penyaev

The intention of this benchmark is to measure events delivery
bandwidth: N threads produce events and 1 thread consumes events calling epoll_wait(2).

Benchmark does measurements for 8, 16, 32, 64 and 128 threads in a loop.

This one differs from epoll-wait-1pmc in that it produces events from many threads and consumes from one, thus mp1c (many producers 1 consumer).

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc Jason Baron <[email protected]>
---
 tools/perf/bench/Build             |   1 +
 tools/perf/bench/bench.h           |   1 +
 tools/perf/bench/epoll-wait-mp1c.c | 175 +++++++++++++++++++++++++++++
 tools/perf/builtin-bench.c         |   1 +
 4 files changed, 178 insertions(+)
 create mode 100644 tools/perf/bench/epoll-wait-mp1c.c
tools/perf/bench/Build +1 -0
index ef07fc40bc35..570df3f475b8 100644
@@ -8,6 +8,7 @@ perf-y += futex-requeue.o
 perf-y += futex-lock-pi.o
 
 perf-y += epoll-wait-1pmc.o
+perf-y += epoll-wait-mp1c.o
 perf-y += epoll-ctl.o
 
 perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-lib.o
tools/perf/bench/bench.h +1 -0
index fb9782624644..2ee7e7256e23 100644
@@ -39,6 +39,7 @@ int bench_futex_requeue(int argc, const char **argv);
 int bench_futex_lock_pi(int argc, const char **argv);
 
 int bench_epoll_wait_1pmc(int argc, const char **argv);
+int bench_epoll_wait_mp1c(int argc, const char **argv);
 int bench_epoll_ctl(int argc, const char **argv);
 
 #define BENCH_FORMAT_DEFAULT_STR	"default"
tools/perf/bench/epoll-wait-mp1c.c new file +175 -0

175 lines not on this page · raw message

tools/perf/builtin-bench.c +1 -0
index 6926b5a5eebf..4426b7afadf3 100644
@@ -71,6 +71,7 @@ static struct bench futex_benchmarks[] = {
 #ifdef HAVE_EVENTFD
 static struct bench epoll_benchmarks[] = {
 	{ "wait-1pmc",	"Benchmark epoll concurrent epoll_waits",       bench_epoll_wait_1pmc	},
+	{ "wait-mp1c",	"Benchmark epoll events delivery bandwidth",    bench_epoll_wait_mp1c	},
 	{ "ctl",	"Benchmark epoll concurrent epoll_ctls",        bench_epoll_ctl		},
 	{ "all",	"Run all futex benchmarks",			NULL			},
 	{ NULL,		NULL,						NULL			}
Signature · 1 line
2.19.1