On Tue, 2024-08-13 at 13:10 -0400, Olivier Langlois wrote: > > --- > include/linux/io_uring_types.h | 12 +++++- > io_uring/fdinfo.c | 4 ++ > io_uring/napi.c | 76 ++++++++++++++++++++++++++++++-- > -- > io_uring/napi.h | 11 +---- > 4 files changed, 86 insertions(+), 17 deletions(-) > > diff --git a/include/linux/io_uring_types.h > b/include/linux/io_uring_types.h > index 3315005df117..c1d1b28f8cca 100644 > --- a/include/linux/io_uring_types.h > +++ b/include/linux/io_uring_types.h > @@ -217,6 +217,16 @@ struct io_alloc_cache { > size_t elem_size; > }; > > +#ifdef CONFIG_NET_RX_BUSY_POLL > +struct io_napi_tracking_ops { > + void (*add_id)(struct io_kiocb *req); > + bool (*do_busy_loop)(struct io_ring_ctx *ctx, > + void *loop_end_arg); > + void (*show_fdinfo)(struct io_ring_ctx *ctx, > + struct seq_file *m); > +}; > +#endif > + I have kept thinking about the critic... add_id is either NULL or equal to dynamic_tracking_add_id and the pointer is even tested before calling it. This pointer is easily removed. show_fdinfo, well, this is is so unimportant, if you don't like it, it is very easily removable too. nobody will notice. the only thing that would remains is do_busy_loop. Its value can either be: - no_tracking_do_busy_loop - dynamic_tracking_do_busy_loop - static_tracking_do_busy_loop so the whole io_napi_tracking_ops could be replaced by a single function pointer At this point, the only thing remaining point to determine is which between calling a function pointer of calling a 2 conditional branches code is more efficient. and I am of the opinion that the function pointer is better due to my C++ background but this is debatable...