diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-11-03 06:26:16 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-11-06 23:55:38 +0300 |
commit | 6ed368cc5d5d255ffffad33cfa02ecf2b77b7c44 (patch) | |
tree | 6f14cb6afe15f04196a905edca31da5d009865a5 /io_uring | |
parent | f03baece08188f2e239c0ca0c098c14c71739ffb (diff) | |
download | linux-6ed368cc5d5d255ffffad33cfa02ecf2b77b7c44.tar.xz |
io_uring: remove task ref helpers
They are only used right where they are defined, just open-code them
inside io_put_task().
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/io_uring.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 4a2282c85464..43afd9da7d07 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -677,30 +677,19 @@ static void io_cqring_do_overflow_flush(struct io_ring_ctx *ctx) mutex_unlock(&ctx->uring_lock); } -/* can be called by any task */ -static void io_put_task_remote(struct task_struct *task) -{ - struct io_uring_task *tctx = task->io_uring; - - percpu_counter_sub(&tctx->inflight, 1); - if (unlikely(atomic_read(&tctx->in_cancel))) - wake_up(&tctx->wait); - put_task_struct(task); -} - -/* used by a task to put its own references */ -static void io_put_task_local(struct task_struct *task) -{ - task->io_uring->cached_refs++; -} - /* must to be called somewhat shortly after putting a request */ static inline void io_put_task(struct task_struct *task) { - if (likely(task == current)) - io_put_task_local(task); - else - io_put_task_remote(task); + struct io_uring_task *tctx = task->io_uring; + + if (likely(task == current)) { + tctx->cached_refs++; + } else { + percpu_counter_sub(&tctx->inflight, 1); + if (unlikely(atomic_read(&tctx->in_cancel))) + wake_up(&tctx->wait); + put_task_struct(task); + } } void io_task_refs_refill(struct io_uring_task *tctx) |