@@ -6839,27 +6839,29 @@ static int io_sq_thread(void *data)
6839
6839
continue ;
6840
6840
}
6841
6841
6842
- needs_sched = true;
6843
6842
prepare_to_wait (& sqd -> wait , & wait , TASK_INTERRUPTIBLE );
6844
- list_for_each_entry (ctx , & sqd -> ctx_list , sqd_list ) {
6845
- if ((ctx -> flags & IORING_SETUP_IOPOLL ) &&
6846
- !list_empty_careful (& ctx -> iopoll_list )) {
6847
- needs_sched = false;
6848
- break ;
6849
- }
6850
- if (io_sqring_entries (ctx )) {
6851
- needs_sched = false;
6852
- break ;
6853
- }
6854
- }
6855
-
6856
- if (needs_sched && !test_bit (IO_SQ_THREAD_SHOULD_PARK , & sqd -> state )) {
6843
+ if (!test_bit (IO_SQ_THREAD_SHOULD_PARK , & sqd -> state )) {
6857
6844
list_for_each_entry (ctx , & sqd -> ctx_list , sqd_list )
6858
6845
io_ring_set_wakeup_flag (ctx );
6859
6846
6860
- mutex_unlock (& sqd -> lock );
6861
- schedule ();
6862
- mutex_lock (& sqd -> lock );
6847
+ needs_sched = true;
6848
+ list_for_each_entry (ctx , & sqd -> ctx_list , sqd_list ) {
6849
+ if ((ctx -> flags & IORING_SETUP_IOPOLL ) &&
6850
+ !list_empty_careful (& ctx -> iopoll_list )) {
6851
+ needs_sched = false;
6852
+ break ;
6853
+ }
6854
+ if (io_sqring_entries (ctx )) {
6855
+ needs_sched = false;
6856
+ break ;
6857
+ }
6858
+ }
6859
+
6860
+ if (needs_sched ) {
6861
+ mutex_unlock (& sqd -> lock );
6862
+ schedule ();
6863
+ mutex_lock (& sqd -> lock );
6864
+ }
6863
6865
list_for_each_entry (ctx , & sqd -> ctx_list , sqd_list )
6864
6866
io_ring_clear_wakeup_flag (ctx );
6865
6867
}
0 commit comments