mirror of
https://github.com/openharmony/third_party_liburing.git
synced 2026-07-21 15:15:31 -04:00
src/queue: only enter the kernel if both submit and need_enter are true
We just take the submit count, and then unconditionally just call sq_ring_needs_enter() to ensure that flags are set appropriately. Only set need_enter for the submit side if sq_ring_needs_enter() is true, which may not be the case if SQPOLL is used. This can avoid a system call if we're not waiting on any CQEs, and the thread is already running. Reported-by: Olivier Langlois <olivier@trillion01.com> Link: https://github.com/axboe/liburing/issues/429#issuecomment-926069364 Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
+1
-3
@@ -112,10 +112,8 @@ static int _io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_pt
|
||||
flags = IORING_ENTER_GETEVENTS | data->get_flags;
|
||||
need_enter = true;
|
||||
}
|
||||
if (data->submit) {
|
||||
sq_ring_needs_enter(ring, &flags);
|
||||
if (data->submit && sq_ring_needs_enter(ring, &flags))
|
||||
need_enter = true;
|
||||
}
|
||||
if (!need_enter)
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user