summaryrefslogtreecommitdiff
path: root/io_uring/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2023-01-16 19:48:58 +0300
committerJens Axboe <axboe@kernel.dk>2023-01-30 01:17:41 +0300
commit89800a2dd570919bfe01ced90c80e3b472d1c723 (patch)
treeb0ed4804c2b6e4a7e944298f13bd34be0a585424 /io_uring/io_uring.c
parentb0b7a7d24b66109a940d09d8d2dcf513e4eaf3a1 (diff)
downloadlinux-89800a2dd570919bfe01ced90c80e3b472d1c723.tar.xz
io_uring: don't export io_put_task()
io_put_task() is only used in uring.c so enclose it there together with __io_put_task(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/43c7f9227e2ab215f1a6069dadbc5382bed346fe.1673887636.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r--io_uring/io_uring.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index c47af3a3dacf..f49d0036657f 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -715,7 +715,7 @@ static void io_cqring_overflow_flush(struct io_ring_ctx *ctx)
io_cqring_do_overflow_flush(ctx);
}
-void __io_put_task(struct task_struct *task, int nr)
+static void __io_put_task(struct task_struct *task, int nr)
{
struct io_uring_task *tctx = task->io_uring;
@@ -725,6 +725,15 @@ void __io_put_task(struct task_struct *task, int nr)
put_task_struct_many(task, nr);
}
+/* must to be called somewhat shortly after putting a request */
+static inline void io_put_task(struct task_struct *task, int nr)
+{
+ if (likely(task == current))
+ task->io_uring->cached_refs += nr;
+ else
+ __io_put_task(task, nr);
+}
+
void io_task_refs_refill(struct io_uring_task *tctx)
{
unsigned int refill = -tctx->cached_refs + IO_TCTX_REFS_CACHE_NR;