Commit 1a924a80 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: refactor io_sq_thread()

Move needs_sched declaration into the block where it's used, so it's
harder to misuse/wrongfully reuse.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/e4a07db1353ee38b924dd1b45394cf8e746130b4.1624543113.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 948e1947
...@@ -6876,7 +6876,7 @@ static int io_sq_thread(void *data) ...@@ -6876,7 +6876,7 @@ static int io_sq_thread(void *data)
mutex_lock(&sqd->lock); mutex_lock(&sqd->lock);
while (1) { while (1) {
bool cap_entries, sqt_spin, needs_sched; bool cap_entries, sqt_spin = false;
if (io_sqd_events_pending(sqd) || signal_pending(current)) { if (io_sqd_events_pending(sqd) || signal_pending(current)) {
if (io_sqd_handle_event(sqd)) if (io_sqd_handle_event(sqd))
...@@ -6885,7 +6885,6 @@ static int io_sq_thread(void *data) ...@@ -6885,7 +6885,6 @@ static int io_sq_thread(void *data)
continue; continue;
} }
sqt_spin = false;
cap_entries = !list_is_singular(&sqd->ctx_list); cap_entries = !list_is_singular(&sqd->ctx_list);
list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) { list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {
int ret = __io_sq_thread(ctx, cap_entries); int ret = __io_sq_thread(ctx, cap_entries);
...@@ -6904,7 +6903,8 @@ static int io_sq_thread(void *data) ...@@ -6904,7 +6903,8 @@ static int io_sq_thread(void *data)
prepare_to_wait(&sqd->wait, &wait, TASK_INTERRUPTIBLE); prepare_to_wait(&sqd->wait, &wait, TASK_INTERRUPTIBLE);
if (!io_sqd_events_pending(sqd) && !io_run_task_work()) { if (!io_sqd_events_pending(sqd) && !io_run_task_work()) {
needs_sched = true; bool needs_sched = true;
list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) { list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {
io_ring_set_wakeup_flag(ctx); io_ring_set_wakeup_flag(ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment