Skip to content

Commit

Permalink
stress-io-uring: improve termination by enabling various flags
Browse files Browse the repository at this point in the history
Enable ORING_SETUP_COOP_TASKRUN, IORING_SETUP_DEFER_TASKRUN and
IORING_SETUP_SINGLE_ISSUE to allow for faster submit call return
allowing less latency on termination of the stressor

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
  • Loading branch information
ColinIanKing committed Apr 8, 2024
1 parent 699aa04 commit adeda08
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions stress-io-uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ static int stress_setup_io_uring(
struct io_uring_params p;

(void)shim_memset(&p, 0, sizeof(p));
#if defined(IORING_SETUP_COOP_TASKRUN) && \
defined(IORING_SETUP_DEFER_TASKRUN) && \
defined(IORING_SETUP_SINGLE_ISSUER)
p.flags = IORING_SETUP_COOP_TASKRUN | IORING_SETUP_DEFER_TASKRUN | IORING_SETUP_SINGLE_ISSUER;
#endif

/*
* 16 is plenty, with too many we end up with lots of cache
* misses, with too few we end up with ring filling. This
Expand Down Expand Up @@ -462,7 +468,7 @@ static int stress_io_uring_submit(
ret = shim_io_uring_enter(submit->io_uring_fd, 1,
1, IORING_ENTER_GETEVENTS);
if (UNLIKELY(ret < 0)) {
if (errno == EBUSY){
if (errno == EBUSY) {
stress_io_uring_complete(args, submit);
goto retry;
}
Expand Down Expand Up @@ -1186,17 +1192,20 @@ static int stress_io_uring_child(stress_args_t *args, void *context)
i = 0;
do {
for (j = 0; j < SIZEOF_ARRAY(stress_io_uring_setups); j++) {
if (!stress_continue(args))
break;
if (user_data[j].supported) {
rc = stress_io_uring_submit(args,
stress_io_uring_setups[j].setup_func,
&io_uring_file, &submit, &user_data[j], NULL);
if ((rc != EXIT_SUCCESS) || !stress_continue(args))
if (rc != EXIT_SUCCESS)
break;
}
}
if (!stress_continue(args))
break;
stress_io_uring_complete(args, &submit);
if (stress_io_uring_complete(args, &submit) < 0)
break;

if (i++ >= 4096) {
i = 0;
Expand Down

0 comments on commit adeda08

Please sign in to comment.