From: Jens Axboe Date: Sat, 3 Oct 2020 17:53:38 +0000 (-0600) Subject: io_uring: avoid syscall restart for signal_pending(), if possible X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=refs%2Fheads%2Ftif-task_work.3;p=linux-2.6-block.git io_uring: avoid syscall restart for signal_pending(), if possible Same kind of optimization we have for the JOBCTL_TASK_WORK. This is safe to do, as we're running task_work manually for this case. Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index aae0ef2ec34d..ee8c1b6aeead 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6755,6 +6755,11 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, if (io_run_task_work()) continue; if (signal_pending(current)) { + /* avoid restart, if we can */ +#ifdef TIF_NOTIFY_SIGNAL + if (test_and_clear_thread_flag(TIF_NOTIFY_SIGNAL)) + continue; +#endif if (current->jobctl & JOBCTL_TASK_WORK) { spin_lock_irq(¤t->sighand->siglock); current->jobctl &= ~JOBCTL_TASK_WORK;