Message ID | 60f4b51e219d1be0a390d53aae2e5a19b775ab69.1655213915.git.asml.silence@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | 5.20 cleanups and poll optimisations | expand |
On 6/14/22 22:37, Pavel Begunkov wrote: > Clean up io_req_task_complete() and deduplicate io_put_kbuf() calls. > > Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> > --- > io_uring/io_uring.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c > index fcee58c6c35e..0f6edf82f262 100644 > --- a/io_uring/io_uring.c > +++ b/io_uring/io_uring.c > @@ -1857,15 +1857,19 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min) > > return ret; > } > -inline void io_req_task_complete(struct io_kiocb *req, bool *locked) > + > +void io_req_task_complete(struct io_kiocb *req, bool *locked) > { > - if (*locked) { > - req->cqe.flags |= io_put_kbuf(req, 0); > + if (req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)) { > + unsigned issue_flags = *locked ? IO_URING_F_UNLOCKED : 0; should be *locked ? 0 : IO_URING_F_UNLOCKED; I think?. I haven't look into the whole series carefully, will do that tomorrow. > + > + req->cqe.flags |= io_put_kbuf(req, issue_flags); > + } > + > + if (*locked) > io_req_add_compl_list(req); > - } else { > - req->cqe.flags |= io_put_kbuf(req, IO_URING_F_UNLOCKED); > + else > io_req_complete_post(req); > - } > } > > /*
On 6/14/22 18:45, Hao Xu wrote: > On 6/14/22 22:37, Pavel Begunkov wrote: >> Clean up io_req_task_complete() and deduplicate io_put_kbuf() calls. >> >> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> >> --- >> io_uring/io_uring.c | 16 ++++++++++------ >> 1 file changed, 10 insertions(+), 6 deletions(-) >> >> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c >> index fcee58c6c35e..0f6edf82f262 100644 >> --- a/io_uring/io_uring.c >> +++ b/io_uring/io_uring.c >> @@ -1857,15 +1857,19 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min) >> return ret; >> } >> -inline void io_req_task_complete(struct io_kiocb *req, bool *locked) >> + >> +void io_req_task_complete(struct io_kiocb *req, bool *locked) >> { >> - if (*locked) { >> - req->cqe.flags |= io_put_kbuf(req, 0); >> + if (req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)) { >> + unsigned issue_flags = *locked ? IO_URING_F_UNLOCKED : 0; > > should be *locked ? 0 : IO_URING_F_UNLOCKED; I think?. I haven't look > into the whole series carefully, will do that tomorrow. Yeah, it should... Thanks >> + >> + req->cqe.flags |= io_put_kbuf(req, issue_flags); >> + } >> + >> + if (*locked) >> io_req_add_compl_list(req); >> - } else { >> - req->cqe.flags |= io_put_kbuf(req, IO_URING_F_UNLOCKED); >> + else >> io_req_complete_post(req); >> - } >> } >> /* >
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index fcee58c6c35e..0f6edf82f262 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1857,15 +1857,19 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min) return ret; } -inline void io_req_task_complete(struct io_kiocb *req, bool *locked) + +void io_req_task_complete(struct io_kiocb *req, bool *locked) { - if (*locked) { - req->cqe.flags |= io_put_kbuf(req, 0); + if (req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)) { + unsigned issue_flags = *locked ? IO_URING_F_UNLOCKED : 0; + + req->cqe.flags |= io_put_kbuf(req, issue_flags); + } + + if (*locked) io_req_add_compl_list(req); - } else { - req->cqe.flags |= io_put_kbuf(req, IO_URING_F_UNLOCKED); + else io_req_complete_post(req); - } } /*
Clean up io_req_task_complete() and deduplicate io_put_kbuf() calls. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> --- io_uring/io_uring.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)