Signed-off-by: Jens Axboe <axboe@kernel.dk>
void *pad;
unsigned int hipri;
unsigned int fixedbufs;
void *pad;
unsigned int hipri;
unsigned int fixedbufs;
+ unsigned int sqpoll_thread;
unsigned int sqpoll_set;
unsigned int sqpoll_cpu;
};
unsigned int sqpoll_set;
unsigned int sqpoll_cpu;
};
},
{
.name = "sqthread_poll",
},
{
.name = "sqthread_poll",
- .lname = "Kernel SQ thread should poll",
+ .lname = "Kernel SQ thread polling",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct ioring_options, sqpoll_thread),
+ .help = "Offload submission/completion to kernel thread",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
+ {
+ .name = "sqthread_poll_cpu",
+ .lname = "SQ Thread Poll CPU",
.type = FIO_OPT_INT,
.cb = fio_ioring_sqpoll_cb,
.type = FIO_OPT_INT,
.cb = fio_ioring_sqpoll_cb,
- .help = "Offload submission to kernel thread",
+ .help = "What CPU to run SQ thread polling on",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_LIBAIO,
},
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_LIBAIO,
},
+ if (!o->sqpoll_thread) {
r = io_uring_enter(ld, 0, actual_min,
IORING_ENTER_GETEVENTS);
if (r < 0) {
r = io_uring_enter(ld, 0, actual_min,
IORING_ENTER_GETEVENTS);
if (r < 0) {
if (!ld->queued)
return 0;
if (!ld->queued)
return 0;
- /* Nothing to do */
- if (o->sqpoll_set) {
+ /*
+ * Kernel side does submission. just need to check if the ring is
+ * flagged as needing a kick, if so, call io_uring_enter(). This
+ * only happens if we've been idle too long.
+ */
+ if (o->sqpoll_thread) {
struct io_sq_ring *ring = &ld->sq_ring;
read_barrier();
struct io_sq_ring *ring = &ld->sq_ring;
read_barrier();
if (o->hipri)
p.flags |= IORING_SETUP_IOPOLL;
if (o->hipri)
p.flags |= IORING_SETUP_IOPOLL;
- if (o->sqpoll_set) {
- p.flags |= IORING_SETUP_SQPOLL | IORING_SETUP_SQ_AFF;
- p.sq_thread_cpu = o->sqpoll_cpu;
+ if (o->sqpoll_thread) {
+ p.flags |= IORING_SETUP_SQPOLL;
+ if (o->sqpoll_set) {
+ p.flags |= IORING_SETUP_SQ_AFF;
+ p.sq_thread_cpu = o->sqpoll_cpu;
+ }
static int polled = 1; /* use IO polling */
static int fixedbufs = 0; /* use fixed user buffers */
static int buffered = 0; /* use buffered IO, not O_DIRECT */
static int polled = 1; /* use IO polling */
static int fixedbufs = 0; /* use fixed user buffers */
static int buffered = 0; /* use buffered IO, not O_DIRECT */
-static int sq_thread = 0; /* use kernel submission/poller thread */
-static int sq_thread_cpu = 0; /* pin above thread to this CPU */
+static int sq_thread_poll = 0; /* use kernel submission/poller thread */
+static int sq_thread_cpu = -1; /* pin above thread to this CPU */
static int io_uring_register_buffers(struct submitter *s)
{
static int io_uring_register_buffers(struct submitter *s)
{
memset(&p, 0, sizeof(p));
memset(&p, 0, sizeof(p));
- if (polled)
- p.flags |= IORING_SETUP_IOPOLL;
- if (sq_thread) {
p.flags |= IORING_SETUP_SQPOLL;
p.flags |= IORING_SETUP_SQPOLL;
- p.sq_thread_cpu = sq_thread_cpu;
+ if (sq_thread_cpu != -1)
+ p.flags |= IORING_SETUP_SQ_AFF;
}
fd = io_uring_setup(DEPTH, &p);
}
fd = io_uring_setup(DEPTH, &p);