two minor cleanup and improvement for sqpoll
cover two minor cleanup and improvement for sqpoll
Xiaoguang Wang (2):
io_uring: initialize 'timeout' properly in io_sq_thread()
io_uring: don't acquire uring_lock twice
fs/io_uring.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.17.2
PATCH 1/2 io_uring: initialize 'timeout' properly in io_sq_thread()
Some static checker reports below warning:
fs/io_uring.c:6939 io_sq_thread()
error: uninitialized symbol 'timeout'.
Fix it.
--- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
@@ -6921,7 +6921,7 @@ static int io_sq_thread(void *data)const struct cred *old_cred =NULL ;struct io_sq_data *sqd = data;struct io_ring_ctx *ctx; -unsigned long timeout; +unsigned long timeout =0 ;DEFINE_WAIT (wait);task_lock (current);
Signature · 1 line
2.17.2
Re: [PATCH 5.11 1/2] io_uring: initialize 'timeout' properly in io_sq_thread()
Quoted 5 lines · Xiaoguang Wang
Some static checker reports below warning:
fs/io_uring.c:6939io_sq_thread()
error: uninitialized symbol 'timeout'.Fix it.
We can also add the reporter:
Quoted 5 lines
Signed-off-by Xiaoguang Wang <[email protected]>---
fs/io_uring.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
LGTM:
Quoted 17 lines
fs/io_uring.c +1
-1@@ -6921,7 +6921,7 @@ static int io_sq_thread(void *data)const struct cred *old_cred =NULL ;struct io_sq_data *sqd = data;struct io_ring_ctx *ctx; -unsigned long timeout; +unsigned long timeout =0 ;DEFINE_WAIT (wait);task_lock (current);Signature · 1 line
2.17.2
Re: [PATCH 5.11 1/2] io_uring: initialize 'timeout' properly in io_sq_thread()
hi,
Quoted 10 lines · Xiaoguang Wang
Quoted 5 lines
Some static checker reports below warning:
fs/io_uring.c:6939io_sq_thread()
error: uninitialized symbol 'timeout'.Fix it.
We can also add the reporter:
Reported-by Dan Carpenter <[email protected]>
Sorry, forgot to add it :)
Quoted 10 lines
Quoted 6 lines
Signed-off-by Xiaoguang Wang <[email protected]>---
fs/io_uring.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)LGTM:
Reviewed-by Stefano Garzarella <[email protected]>
Thanks.
Regards,
Xiaoguang Wang
Quoted 18 lines
Quoted 18 lines
fs/io_uring.c +1
-1@@ -6921,7 +6921,7 @@ static int io_sq_thread(void *data) const struct cred *old_cred = NULL; struct io_sq_data *sqd = data; struct io_ring_ctx *ctx; - unsigned long timeout; + unsigned long timeout = 0; DEFINE_WAIT(wait); task_lock(current);Signature · 1 line
2.17.2
PATCH 2/2 io_uring: don't acquire uring_lock twice
In reply to Xiaoguang WangBoth IOPOLL and sqes handling need to acquire uring_lock, combine them together, then we just need to acquire uring_lock once.
--- fs/io_uring.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
fs/io_uring.c +7 -11
@@ -6859,23 +6859,19 @@ static int __io_sq_thread(struct io_ring_ctx *ctx, bool cap_entries)unsigned int to_submit;int ret =0 ; -if (!list_empty (&ctx->iopoll_list)) { -unsigned nr_events =0 ; - -mutex_lock (&ctx->uring_lock); -if (!list_empty (&ctx->iopoll_list)) -io_do_iopoll (ctx, &nr_events,0 ); -mutex_unlock (&ctx->uring_lock); - } - to_submit =io_sqring_entries (ctx);/* if we're handling multiple rings, cap submit size for fairness */ if (cap_entries && to_submit >8 ) to_submit =8 ; -if (to_submit) { +if (!list_empty (&ctx->iopoll_list) || to_submit) { +unsigned nr_events =0 ; +mutex_lock (&ctx->uring_lock); -if (likely (!percpu_ref_is_dying (&ctx->refs))) +if (!list_empty (&ctx->iopoll_list)) +io_do_iopoll (ctx, &nr_events,0 ); + +if (to_submit &&likely (!percpu_ref_is_dying (&ctx->refs))) ret =io_submit_sqes (ctx, to_submit);mutex_unlock (&ctx->uring_lock); }
Signature · 1 line
2.17.2
Quoted 6 lines · Xiaoguang Wang
Xiaoguang Wang (2):
io_uring: initialize 'timeout' properly inio_sq_thread()
io_uring: don't acquireuring_locktwicefs/io_uring.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
Applied, thanks.
Signature · 1 line
Jens Axboe