io_uring: inline io_req_task_work_add()
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 11 Nov 2022 16:54:08 +0000 (16:54 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 21 Nov 2022 14:44:18 +0000 (07:44 -0700)
__io_req_task_work_add() is huge but marked inline, that makes compilers
to generate lots of garbage. Inline the wrapper caller
io_req_task_work_add() instead.

before and after:
   text    data     bss     dec     hex filename
  47347   16248       8   63603    f873 io_uring/io_uring.o
   text    data     bss     dec     hex filename
  45303   16248       8   61559    f077 io_uring/io_uring.o

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/26dc8c28ca0160e3269ef3e55c5a8b917c4d4450.1668162751.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
io_uring/io_uring.h

index c770eed4d71754d25cbbf4e1dfe7b52ab64aaa1c..8f452dfb4f1ca9cc649c144f477b34e5b4e8b05a 100644 (file)
@@ -1127,7 +1127,7 @@ static void io_req_local_work_add(struct io_kiocb *req)
        __io_cqring_wake(ctx);
 }
 
-static inline void __io_req_task_work_add(struct io_kiocb *req, bool allow_local)
+void __io_req_task_work_add(struct io_kiocb *req, bool allow_local)
 {
        struct io_uring_task *tctx = req->task->io_uring;
        struct io_ring_ctx *ctx = req->ctx;
@@ -1159,11 +1159,6 @@ static inline void __io_req_task_work_add(struct io_kiocb *req, bool allow_local
        }
 }
 
-void io_req_task_work_add(struct io_kiocb *req)
-{
-       __io_req_task_work_add(req, true);
-}
-
 static void __cold io_move_task_work_from_local(struct io_ring_ctx *ctx)
 {
        struct llist_node *node;
index cef5ff924e6357e7493489928d020302706d9177..38d9e149d2db77ad99938bfa57ce526f2b43801e 100644 (file)
@@ -50,9 +50,9 @@ static inline bool io_req_ffs_set(struct io_kiocb *req)
        return req->flags & REQ_F_FIXED_FILE;
 }
 
+void __io_req_task_work_add(struct io_kiocb *req, bool allow_local);
 bool io_is_uring_fops(struct file *file);
 bool io_alloc_async_data(struct io_kiocb *req);
-void io_req_task_work_add(struct io_kiocb *req);
 void io_req_tw_post_queue(struct io_kiocb *req, s32 res, u32 cflags);
 void io_req_task_queue(struct io_kiocb *req);
 void io_queue_iowq(struct io_kiocb *req, bool *dont_use);
@@ -82,6 +82,11 @@ bool __io_alloc_req_refill(struct io_ring_ctx *ctx);
 bool io_match_task_safe(struct io_kiocb *head, struct task_struct *task,
                        bool cancel_all);
 
+static inline void io_req_task_work_add(struct io_kiocb *req)
+{
+       __io_req_task_work_add(req, true);
+}
+
 #define io_for_each_link(pos, head) \
        for (pos = (head); pos; pos = pos->link)