summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-10-03 11:53:38 -0600
committerJens Axboe <axboe@kernel.dk>2020-10-05 08:43:24 -0600
commit539777a03dbf74197afb49c63a050e516964ce6d (patch)
treea64959ec797d2b63ce71d7603d791d68f84da7f1
parent68b2b121a9256e90f5f585b42b91e5db9ed2f14b (diff)
io_uring: avoid syscall restart for signal_pending(), if possibletif-task_work.3
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 <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c5
1 files changed, 5 insertions, 0 deletions
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(&current->sighand->siglock);
current->jobctl &= ~JOBCTL_TASK_WORK;