* [PATCH liburing 1/1] examples/sendzc: test background polling
@ 2024-04-08 0:14 Pavel Begunkov
2024-04-09 3:46 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2024-04-08 0:14 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe, asml.silence
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH liburing 1/1] examples/sendzc: test background polling
2024-04-08 0:14 [PATCH liburing 1/1] examples/sendzc: test background polling Pavel Begunkov
@ 2024-04-09 3:46 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2024-04-09 3:46 UTC (permalink / raw)
To: io-uring, Pavel Begunkov
On Mon, 08 Apr 2024 01:14:00 +0100, Pavel Begunkov wrote:
> 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.
>
>
Applied, thanks!
[1/1] examples/sendzc: test background polling
commit: f1dfb94bdaf1de14281030e28dd64f4d23d615a3
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-09 3:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 0:14 [PATCH liburing 1/1] examples/sendzc: test background polling Pavel Begunkov
2024-04-09 3:46 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox