]> www.infradead.org Git - users/hch/block.git/commitdiff
io_uring: move provided and fixed buffers into the same io_kiocb area
authorJens Axboe <axboe@kernel.dk>
Sat, 30 Apr 2022 20:35:17 +0000 (14:35 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 5 May 2022 23:17:31 +0000 (17:17 -0600)
These are mutually exclusive - if you use provided buffers, then you
cannot use fixed buffers and vice versa. Move them into the same spot
in the io_kiocb, which is also advantageous for provided buffers as
they get near the submit side hot cacheline.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 7b5bf523c52ca20d5da14802f6c097fe3bf8341b..87605053d566e3944224712a9e7d6e6de7e5af57 100644 (file)
@@ -958,8 +958,14 @@ struct io_kiocb {
        struct task_struct              *task;
 
        struct io_rsrc_node             *rsrc_node;
-       /* store used ubuf, so we can prevent reloading */
-       struct io_mapped_ubuf           *imu;
+
+       union {
+               /* store used ubuf, so we can prevent reloading */
+               struct io_mapped_ubuf   *imu;
+
+               /* stores selected buf, valid IFF REQ_F_BUFFER_SELECTED is set */
+               struct io_buffer        *kbuf;
+       };
 
        union {
                /* used by request caches, completion batching and iopoll */
@@ -976,8 +982,6 @@ struct io_kiocb {
        struct async_poll               *apoll;
        /* opcode allocated if it needs to store data for async defer */
        void                            *async_data;
-       /* stores selected buf, valid IFF REQ_F_BUFFER_SELECTED is set */
-       struct io_buffer                *kbuf;
        /* linked requests, IFF REQ_F_HARDLINK or REQ_F_LINK are set */
        struct io_kiocb                 *link;
        /* custom credentials, valid IFF REQ_F_CREDS is set */