From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing 1/1] examples/sendzc: test background polling
Date: Mon, 8 Apr 2024 01:14:00 +0100 [thread overview]
Message-ID: <152a9e0773920d0affd675d1e75983271bcd6732.1712535205.git.asml.silence@gmail.com> (raw)
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 <[email protected]>
---
examples/send-zerocopy.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
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;
}
}
--
2.44.0
next reply other threads:[~2024-04-08 0:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 0:14 Pavel Begunkov [this message]
2024-04-09 3:46 ` [PATCH liburing 1/1] examples/sendzc: test background polling Jens Axboe
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=152a9e0773920d0affd675d1e75983271bcd6732.1712535205.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/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