public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing 0/3] __io_uring_get_cqe() fix/optimization
@ 2020-05-19 21:52 Bijan Mottahedeh
  2020-05-19 21:52 ` [PATCH liburing 1/3] preseve wait_nr if SETUP_IOPOLL is set Bijan Mottahedeh
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bijan Mottahedeh @ 2020-05-19 21:52 UTC (permalink / raw)
  To: axboe; +Cc: io-uring

This patch set and a corresponding kernel patch set are fixes and
optimizations resulting from running unit test 500f9fbadef8-test.

- Patch 1 is a fix to the test hanging when it runs on a non-mq queue.

The patch preserves the value of wait_nr if SETUP_IOPOLL is set
since otherwise __sys_io_uring_enter() could never be called
__io_uring_peek_cqe() could never find new completions.

With this patch applied, two problems were hit in the kernel as described
in the kernel patch set, which caused 500f9fbadef8-test to fail and
to hang.  With all three patches, 500f9fbadef8-test either passes
successfully or skips the test gracefully with the following message:

Polling not supported in current dir, test skipped

- Patch 2 is an optimization for io_uring_enter() system calls.

If we want to wait for completions (wait_nr > 0), account for the
completion we might fetch with __io_uring_peek_cqe().  For example,
with wait_nr=1 and submit=0, there is no need to call io_uring_enter()
if the peek call finds a completion.

Below are the perf results for 500f9fbadef8-test without/with the fix:

perf stat -e syscalls:sys_enter_io_uring_enter 500f9fbadef8-test

12,289     syscalls:sys_enter_io_uring_enter
8,193      syscalls:sys_enter_io_uring_enter

- Patch 3 is a cleanup with no functional changes.

Since we always have

io_uring_wait_cqe_nr()
-> __io_uring_get_cqe()
   -> __io_uring_peek_cqe()

remove the direct call from io_uring_wait_cqe_nr() to __io_uring_peek_cqe().

After the removal, __io_uring_peek_cqe() is called only from
__io_uring_get_cqe() so move the two routines together(). Without the
move, compilation fails with a 'defined but not used' error.

Bijan Mottahedeh (3):
  preseve wait_nr if SETUP_IOPOLL is set
  update wait_nr to account for completed event
  remove duplicate call to __io_uring_peek_cqe()

 src/include/liburing.h | 32 --------------------------------
 src/queue.c            | 38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 33 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-19 22:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-19 21:52 [PATCH liburing 0/3] __io_uring_get_cqe() fix/optimization Bijan Mottahedeh
2020-05-19 21:52 ` [PATCH liburing 1/3] preseve wait_nr if SETUP_IOPOLL is set Bijan Mottahedeh
2020-05-19 21:52 ` [PATCH liburing 2/3] update wait_nr to account for completed event Bijan Mottahedeh
2020-05-19 21:52 ` [PATCH liburing 3/3] remove duplicate call to __io_uring_peek_cqe() Bijan Mottahedeh
2020-05-19 22:12 ` [PATCH liburing 0/3] __io_uring_get_cqe() fix/optimization Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox