aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2024-04-08 01:14:00 +0100
committerJens Axboe <axboe@kernel.dk>2024-04-08 21:45:58 -0600
commitf1dfb94bdaf1de14281030e28dd64f4d23d615a3 (patch)
treedad1681564ae27a5503492e8fa575085f09d2900
parentef3cae5022b717ebc495e39df902d85b83f402f5 (diff)
downloadliburing-f1dfb94bdaf1de14281030e28dd64f4d23d615a3.tar.gz
examples/sendzc: test background polling
There are some performance effects depending on whether the sock is polled or not even when it never actually triggers. That applies to non-zerocopy as well. Add a flag to test it. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/152a9e0773920d0affd675d1e75983271bcd6732.1712535205.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--examples/send-zerocopy.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/examples/send-zerocopy.c b/examples/send-zerocopy.c
index 7ab58d7..691a0cc 100644
--- a/examples/send-zerocopy.c
+++ b/examples/send-zerocopy.c
@@ -74,6 +74,7 @@ static int cfg_type = 0;
static int cfg_payload_len;
static int cfg_port = 8000;
static int cfg_runtime_ms = 4200;
+static bool cfg_rx_poll = false;
static socklen_t cfg_alen;
static char *str_addr = NULL;
@@ -370,6 +371,17 @@ static void do_tx(struct thread_data *td, int domain, int type, int protocol)
if (ret)
t_error(1, ret, "io_uring: buffer registration");
+ if (cfg_rx_poll) {
+ struct io_uring_sqe *sqe;
+
+ sqe = io_uring_get_sqe(&ring);
+ io_uring_prep_poll_add(sqe, fd, POLLIN);
+
+ ret = io_uring_submit(&ring);
+ if (ret != 1)
+ t_error(1, ret, "submit poll");
+ }
+
pthread_barrier_wait(&barrier);
tstart = gettimeofday_ms();
@@ -504,7 +516,7 @@ static void parse_opts(int argc, char **argv)
cfg_payload_len = max_payload_len;
- while ((c = getopt(argc, argv, "46D:p:s:t:n:z:b:l:dC:T:R")) != -1) {
+ while ((c = getopt(argc, argv, "46D:p:s:t:n:z:b:l:dC:T:Ry")) != -1) {
switch (c) {
case '4':
if (cfg_family != PF_UNSPEC)
@@ -556,6 +568,9 @@ static void parse_opts(int argc, char **argv)
case 'R':
cfg_rx = 1;
break;
+ case 'y':
+ cfg_rx_poll = 1;
+ break;
}
}