@@ -137,15 +137,12 @@ static bool io_napi_busy_loop_should_end(void *data,
137
137
}
138
138
139
139
static bool __io_napi_do_busy_loop (struct io_ring_ctx * ctx ,
140
+ bool (* loop_end )(void * , unsigned long ),
140
141
void * loop_end_arg )
141
142
{
142
143
struct io_napi_entry * e ;
143
- bool (* loop_end )(void * , unsigned long ) = NULL ;
144
144
bool is_stale = false;
145
145
146
- if (loop_end_arg )
147
- loop_end = io_napi_busy_loop_should_end ;
148
-
149
146
list_for_each_entry_rcu (e , & ctx -> napi_list , list ) {
150
147
napi_busy_loop_rcu (e -> napi_id , loop_end , loop_end_arg ,
151
148
ctx -> napi_prefer_busy_poll , BUSY_POLL_BUDGET );
@@ -161,18 +158,22 @@ static void io_napi_blocking_busy_loop(struct io_ring_ctx *ctx,
161
158
struct io_wait_queue * iowq )
162
159
{
163
160
unsigned long start_time = busy_loop_current_time ();
161
+ bool (* loop_end )(void * , unsigned long ) = NULL ;
164
162
void * loop_end_arg = NULL ;
165
163
bool is_stale = false;
166
164
167
165
/* Singular lists use a different napi loop end check function and are
168
166
* only executed once.
169
167
*/
170
- if (list_is_singular (& ctx -> napi_list ))
168
+ if (list_is_singular (& ctx -> napi_list )) {
169
+ loop_end = io_napi_busy_loop_should_end ;
171
170
loop_end_arg = iowq ;
171
+ }
172
172
173
173
scoped_guard (rcu ) {
174
174
do {
175
- is_stale = __io_napi_do_busy_loop (ctx , loop_end_arg );
175
+ is_stale = __io_napi_do_busy_loop (ctx , loop_end ,
176
+ loop_end_arg );
176
177
} while (!io_napi_busy_loop_should_end (iowq , start_time ) &&
177
178
!loop_end_arg );
178
179
}
@@ -308,7 +309,7 @@ int io_napi_sqpoll_busy_poll(struct io_ring_ctx *ctx)
308
309
return 0 ;
309
310
310
311
scoped_guard (rcu ) {
311
- is_stale = __io_napi_do_busy_loop (ctx , NULL );
312
+ is_stale = __io_napi_do_busy_loop (ctx , NULL , NULL );
312
313
}
313
314
314
315
io_napi_remove_stale (ctx , is_stale );
0 commit comments