summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-02-13 09:25:44 -0700
committerJens Axboe <axboe@kernel.dk>2020-02-13 09:25:44 -0700
commit2454d6301d83a714d0775662b512fd46dbf82a0d (patch)
tree51b85125b67cb8caa16604fbb53fa8fcd92cdb1e
parent8f979c629464f080adb4ec060399d9a75d73a4d6 (diff)
downloadliburing-2454d6301d83a714d0775662b512fd46dbf82a0d.tar.gz
liburing-2454d6301d83a714d0775662b512fd46dbf82a0d.tar.bz2
test/poll-cancel-ton: reap events after submit
If the polls complete, then we can have events immediately. Ensure we nowait reap to prevent overflows. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/poll-cancel-ton.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/poll-cancel-ton.c b/test/poll-cancel-ton.c
index c963bd0..16c5b58 100644
--- a/test/poll-cancel-ton.c
+++ b/test/poll-cancel-ton.c
@@ -19,13 +19,13 @@
static void *sqe_index[POLL_COUNT];
-static int reap_events(struct io_uring *ring, unsigned nr_events)
+static int reap_events(struct io_uring *ring, unsigned nr_events, int nowait)
{
struct io_uring_cqe *cqe;
int i, ret = 0;
for (i = 0; i < nr_events; i++) {
- if (!i)
+ if (!i && !nowait)
ret = io_uring_wait_cqe(ring, &cqe);
else
ret = io_uring_peek_cqe(ring, &cqe);
@@ -64,7 +64,7 @@ static int del_polls(struct io_uring *ring, int fd, int nr)
return 1;
}
nr -= batch;
- ret = reap_events(ring, 2 * batch);
+ ret = reap_events(ring, 2 * batch, 0);
}
return 0;
}
@@ -94,6 +94,7 @@ static int add_polls(struct io_uring *ring, int fd, int nr)
}
nr -= batch;
pending += batch;
+ reap_events(ring, batch, 1);
}
return 0;
}