Skip to content

Commit 6ed368c

Browse files
committed
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 <[email protected]>
1 parent f03baec commit 6ed368c

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

io_uring/io_uring.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -677,30 +677,19 @@ static void io_cqring_do_overflow_flush(struct io_ring_ctx *ctx)
677677
mutex_unlock(&ctx->uring_lock);
678678
}
679679

680-
/* can be called by any task */
681-
static void io_put_task_remote(struct task_struct *task)
682-
{
683-
struct io_uring_task *tctx = task->io_uring;
684-
685-
percpu_counter_sub(&tctx->inflight, 1);
686-
if (unlikely(atomic_read(&tctx->in_cancel)))
687-
wake_up(&tctx->wait);
688-
put_task_struct(task);
689-
}
690-
691-
/* used by a task to put its own references */
692-
static void io_put_task_local(struct task_struct *task)
693-
{
694-
task->io_uring->cached_refs++;
695-
}
696-
697680
/* must to be called somewhat shortly after putting a request */
698681
static inline void io_put_task(struct task_struct *task)
699682
{
700-
if (likely(task == current))
701-
io_put_task_local(task);
702-
else
703-
io_put_task_remote(task);
683+
struct io_uring_task *tctx = task->io_uring;
684+
685+
if (likely(task == current)) {
686+
tctx->cached_refs++;
687+
} else {
688+
percpu_counter_sub(&tctx->inflight, 1);
689+
if (unlikely(atomic_read(&tctx->in_cancel)))
690+
wake_up(&tctx->wait);
691+
put_task_struct(task);
692+
}
704693
}
705694

706695
void io_task_refs_refill(struct io_uring_task *tctx)

0 commit comments

Comments
 (0)