Message ID | 20221124093559.3780686-2-dylany@meta.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | io_uring: batch multishot completions | expand |
On 11/24/22 09:35, Dylan Yudaken wrote: > For consistency always defer completion if specified in the issue flags. > > Signed-off-by: Dylan Yudaken <dylany@meta.com> > --- > io_uring/io_uring.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c > index cc27413129fc..ec23ebb63489 100644 > --- a/io_uring/io_uring.c > +++ b/io_uring/io_uring.c > @@ -852,7 +852,9 @@ static void __io_req_complete_post(struct io_kiocb *req) > > void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) > { > - if (!(issue_flags & IO_URING_F_UNLOCKED) || > + if (issue_flags & IO_URING_F_COMPLETE_DEFER) { > + io_req_complete_defer(req); > + } else if (!(issue_flags & IO_URING_F_UNLOCKED) || > !(req->ctx->flags & IORING_SETUP_IOPOLL)) { > __io_req_complete_post(req); > } else { I think it's better to leave it and not impose a second meaning onto it. We can explicitly call io_req_complete_defer() in all places that require it, maybe with a new helper like io_req_complete() if needed.
On Thu, 2022-11-24 at 15:56 +0000, Pavel Begunkov wrote: > On 11/24/22 09:35, Dylan Yudaken wrote: > > For consistency always defer completion if specified in the issue > > flags. > > > > Signed-off-by: Dylan Yudaken <dylany@meta.com> > > --- > > io_uring/io_uring.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c > > index cc27413129fc..ec23ebb63489 100644 > > --- a/io_uring/io_uring.c > > +++ b/io_uring/io_uring.c > > @@ -852,7 +852,9 @@ static void __io_req_complete_post(struct > > io_kiocb *req) > > > > void io_req_complete_post(struct io_kiocb *req, unsigned > > issue_flags) > > { > > - if (!(issue_flags & IO_URING_F_UNLOCKED) || > > + if (issue_flags & IO_URING_F_COMPLETE_DEFER) { > > + io_req_complete_defer(req); > > + } else if (!(issue_flags & IO_URING_F_UNLOCKED) || > > !(req->ctx->flags & IORING_SETUP_IOPOLL)) { > > __io_req_complete_post(req); > > } else { > > I think it's better to leave it and not impose a second meaning > onto it. We can explicitly call io_req_complete_defer() in all > places that require it, maybe with a new helper like > io_req_complete() > if needed. > I think you may be right - I'll give it a try and send some clean up patches. Dylan
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index cc27413129fc..ec23ebb63489 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -852,7 +852,9 @@ static void __io_req_complete_post(struct io_kiocb *req) void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) { - if (!(issue_flags & IO_URING_F_UNLOCKED) || + if (issue_flags & IO_URING_F_COMPLETE_DEFER) { + io_req_complete_defer(req); + } else if (!(issue_flags & IO_URING_F_UNLOCKED) || !(req->ctx->flags & IORING_SETUP_IOPOLL)) { __io_req_complete_post(req); } else {
For consistency always defer completion if specified in the issue flags. Signed-off-by: Dylan Yudaken <dylany@meta.com> --- io_uring/io_uring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)