On 5/27/21 10:48 PM, Noah Goldstein wrote: > On Mon, May 24, 2021 at 7:51 PM Pavel Begunkov <asml.silence@xxxxxxxxx> wrote: >> >> If for/while is simple enough it's more prefered over goto with labels >> as the former one is more explicit and easier to read. So, replace a >> trivial goto-based loop in io_wqe_worker() with a while. >> >> Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> >> --- >> fs/io-wq.c | 9 +++++---- >> 1 file changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/fs/io-wq.c b/fs/io-wq.c >> index a0e43d1b94af..712eb062f822 100644 >> --- a/fs/io-wq.c >> +++ b/fs/io-wq.c >> @@ -538,12 +538,13 @@ static int io_wqe_worker(void *data) >> long ret; >> >> set_current_state(TASK_INTERRUPTIBLE); >> -loop: >> - raw_spin_lock_irq(&wqe->lock); >> - if (io_wqe_run_queue(wqe)) { >> + while (1) { >> + raw_spin_lock_irq(&wqe->lock); > Can acquiring the spinlock be hoisted from the loop? lock(); while(1) { ... } unlock(); If this, then no. If taken inside io_worker_handle_work(), maybe, but not with this commit. >> + if (!io_wqe_run_queue(wqe)) >> + break; >> io_worker_handle_work(worker); >> - goto loop; >> } >> + >> __io_worker_idle(wqe, worker); >> raw_spin_unlock_irq(&wqe->lock); >> if (io_flush_signals()) >> -- >> 2.31.1 >> -- Pavel Begunkov