Skip to contentSkip to conversation

io_uring: clear TIF_NOTIFY_SIGNAL if set and task_work not available

PATCH Superseded Jens Axboe 1 participant 1 message Nov 25, 2022 io_uring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring: clear TIF_NOTIFY_SIGNAL if set and task_work not available

If we have io-wq or SQPOLL setting the task_work notify signal but the task itself doesn't have task_work to process, we don't clear the flag and hence will enter a repeated check loop if we're waiting on events or file/buf references to go away.

This was introduced in a recent patch which eliminated gating the task_work run on just that flag, but that fix meant that we know don't clear the flag if the task itsel doesn't have task_work to run.

Fixes 46a525e199e4 ("io_uring: don't gate task_work run on TIF_NOTIFY_SIGNAL")

---

io_uring/io_uring.h +2 -3
index cef5ff924e63..0ecfa36c049e 100644
@@ -238,9 +238,8 @@ static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx)
 
 static inline int io_run_task_work(void)
 {
-	if (task_work_pending(current)) {
-		if (test_thread_flag(TIF_NOTIFY_SIGNAL))
-			clear_notify_signal();
+	if (task_work_pending(current) || test_thread_flag(TIF_NOTIFY_SIGNAL)) {
+		clear_notify_signal();
 		__set_current_state(TASK_RUNNING);
 		task_work_run();
 		return 1;
Signature · 1 line
Jens Axboe