Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/napi: clean up __io_napi_do_busy_loop

__io_napi_do_busy_loop now requires to have loop_end in its parameters.
This makes the code cleaner and also has the benefit of removing a
branch since the only caller not passing NULL for loop_end_arg is also
setting the value conditionally.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Link: https://lore.kernel.org/r/d5b9bb91b1a08fff50525e1c18d7b4709b9ca100.1728828877.git.olivier@trillion01.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Olivier Langlois and committed by
Jens Axboe
71afd926 db1e1adf

+8 -7
+8 -7
io_uring/napi.c
··· 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 - 146 - if (loop_end_arg) 147 - loop_end = io_napi_busy_loop_should_end; 148 145 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, ··· 158 161 struct io_wait_queue *iowq) 159 162 { 160 163 unsigned long start_time = busy_loop_current_time(); 164 + bool (*loop_end)(void *, unsigned long) = NULL; 161 165 void *loop_end_arg = NULL; 162 166 bool is_stale = false; 163 167 164 168 /* Singular lists use a different napi loop end check function and are 165 169 * only executed once. 166 170 */ 167 - if (list_is_singular(&ctx->napi_list)) 171 + if (list_is_singular(&ctx->napi_list)) { 172 + loop_end = io_napi_busy_loop_should_end; 168 173 loop_end_arg = iowq; 174 + } 169 175 170 176 scoped_guard(rcu) { 171 177 do { 172 - is_stale = __io_napi_do_busy_loop(ctx, loop_end_arg); 178 + is_stale = __io_napi_do_busy_loop(ctx, loop_end, 179 + loop_end_arg); 173 180 } while (!io_napi_busy_loop_should_end(iowq, start_time) && 174 181 !loop_end_arg); 175 182 } ··· 309 308 return 0; 310 309 311 310 scoped_guard(rcu) { 312 - is_stale = __io_napi_do_busy_loop(ctx, NULL); 311 + is_stale = __io_napi_do_busy_loop(ctx, NULL, NULL); 313 312 } 314 313 315 314 io_napi_remove_stale(ctx, is_stale);