Commit 9acf37a1 authored by Florian Fischer's avatar Florian Fischer
Browse files

[io-uring-sqpoll] increase queues and busy wait till sqe are available

parent 2d0da70f
Pipeline #66428 passed with stage
in 1 minute and 21 seconds
......@@ -3,12 +3,14 @@
#include <liburing.h>
#include <stdlib.h>
#define unlikely(x) __builtin_expect(!!(x), 0)
#include "rdtsc.h"
struct io_uring ring;
void init(__attribute__((unused)) int fd) {
int res = io_uring_queue_init(1, &ring, IORING_SETUP_SQPOLL);
int res = io_uring_queue_init(16, &ring, IORING_SETUP_SQPOLL);
if (res < 0) {
errno = res;
err(EXIT_FAILURE, "io_uring_setup failed");
......@@ -20,6 +22,9 @@ int64_t do_write(int fd, const void* buf, size_t count) {
clock_before = rdtsc_s();
struct io_uring_sqe *sqe = io_uring_get_sqe(&ring);
while (unlikely(!sqe)) {
sqe = io_uring_get_sqe(&ring);
}
io_uring_prep_write(sqe, fd, buf, count, 0);
int res = io_uring_submit_and_wait(&ring, 1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment