Re: [PATCH 6.12 007/242] io_uring/kbuf: uninline __io_put_kbufs

Harshit Mogalapalli
2026-04-10T12:12:22Z

Hi Greg,

On 08/04/26 23:30, Greg Kroah-Hartman wrote:
> 6.12-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Pavel Begunkov <asml.silence@gmail.com>
>
> Commit 5d3e51240d89678b87b5dc6987ea572048a0f0eb upstream.
>
> __io_put_kbufs() and other helper functions are too large to be inlined,
> compilers would normally refuse to do so. Uninline it and move together
> with io_kbuf_commit into kbuf.c.
>
> io_kbuf_commitSigned-off-by: Pavel Begunkov <asml.silence@gmail.com>
>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> Link: https://lore.kernel.org/r/3dade7f55ad590e811aff83b1ec55c9c04e17b2b.1738724373.git.asml.silence@gmail.com
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
...

>
> +static inline bool __io_put_kbuf_ring(struct io_kiocb *req, int len, int nr)
> +{
> + struct io_buffer_list *bl = req->buf_list;
> + bool ret = true;
> +
> + if (bl) {
> + ret = io_kbuf_commit(req, bl, len, nr);
> + req->buf_index = bl->bgid;
> + }
> + req->flags &= ~REQ_F_BUFFER_RING;
> + return ret;
> +}
> +...

Looks like this backport is undoing the commit: 0866809dfe19
("io_uring/kbuf: propagate BUF_MORE through early buffer commit path")

^^ in additions above we don't have this:

@@ -165,7 +165,9 @@ static inline bool __io_put_kbuf_ring(struct
io_kiocb *req, int len, int nr)
ret = io_kbuf_commit(req, bl, len, nr);
req->buf_index = bl->bgid;
}
- req->flags &= ~REQ_F_BUFFER_RING;
+ if (ret && (req->flags & REQ_F_BUF_MORE))
+ ret = false;
+ req->flags &= ~(REQ_F_BUFFER_RING | REQ_F_BUF_MORE);
return ret;
}

but this is being part of what is removed below. I think we should
re-backport commit: 418eab7a6f3c ("io_uring/kbuf: propagate BUF_MORE
through early buffer commit path") ?

> -static inline bool __io_put_kbuf_ring(struct io_kiocb *req, int len, int nr)
> -{
> - struct io_buffer_list *bl = req->buf_list;
> - bool ret = true;
> -
> - if (bl) {
> - ret = io_kbuf_commit(req, bl, len, nr);
> - req->buf_index = bl->bgid;
> - }
> - if (ret && (req->flags & REQ_F_BUF_MORE))
> - ret = false;
> - req->flags &= ~(REQ_F_BUFFER_RING | REQ_F_BUF_MORE);
> - return ret;
> -}
> -

Thanks,
Harshit