Skip to contentSkip to conversation

io_uring/io-wq: don't call try_to_wake_up() twice in io_wq_worker_wake()

PATCH Applied Oleg Nesterov 3 participants 3 messages Oct 11 – Oct 12 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring/io-wq: don't call try_to_wake_up() twice in io_wq_worker_wake()

io_wq_worker_wake() does an unconditional wake_up_process(). This means that __set_notify_signal() makes no real sense. Change it to use set_tsk_thread_flag(TIF_NOTIFY_SIGNAL) instead to avoid test_and_set_bit() and another wake_up_state(TASK_INTERRUPTIBLE) if NOTIFY_SIGNAL was not set.

Perhaps io_wq_worker_wake() can rely on __set_notify_signal() solely, but I don't understand this code enough and this patch doesn't change the current behaviour.

---
 io_uring/io-wq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/io-wq.c +1 -1
index 2ca223e47d41..eb90961f32d8 100644
@@ -972,7 +972,7 @@ static void io_wq_for_each_worker(struct io_wq *wq,
 
 static bool io_wq_worker_wake(struct io_worker *worker, void *data)
 {
-	__set_notify_signal(worker->task);
+	set_tsk_thread_flag(worker->task, TIF_NOTIFY_SIGNAL);
 	wake_up_process(worker->task);
 	return false;
 }
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Oleg Nesterov

io_wq_worker_wake() does an unconditional wake_up_process(). This means that __set_notify_signal() makes no real sense. Change it to use set_tsk_thread_flag(TIF_NOTIFY_SIGNAL) instead to avoid test_and_set_bit() and another wake_up_state(TASK_INTERRUPTIBLE) if NOTIFY_SIGNAL was not set.

Perhaps io_wq_worker_wake() can rely on __set_notify_signal() solely, but I don't understand this code enough and this patch doesn't change the current behaviour.

---

maintainer Applied
#2 lore raw
In reply to Oleg Nesterov
Quoted 10 lines · Oleg Nesterov

io_wq_worker_wake() does an unconditional wake_up_process(). This means that __set_notify_signal() makes no real sense. Change it to use set_tsk_thread_flag(TIF_NOTIFY_SIGNAL) instead to avoid test_and_set_bit() and another wake_up_state(TASK_INTERRUPTIBLE) if NOTIFY_SIGNAL was not set.

Perhaps io_wq_worker_wake() can rely on __set_notify_signal() solely, but I don't understand this code enough and this patch doesn't change the current behaviour.

[...]

Applied, thanks!

[1/1] io_uring/io-wq: don't call try_to_wake_up() twice in io_wq_worker_wake()

      commit: e889b0e4cafddb3d68c3595dc01b7128fd35fbef

Best regards,

Signature · 1 line
Jens Axboe