mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
io_uring: inline ->registered_rings
There can be only 16 registered rings, no need to allocate an array for them separately but store it in tctx. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/495f0b953c87994dd9e13de2134019054fa5830d.1655310733.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
48c13d8980
commit
6a02e4be81
@ -53,7 +53,6 @@ void __io_uring_free(struct task_struct *tsk)
|
||||
WARN_ON_ONCE(tctx->io_wq);
|
||||
WARN_ON_ONCE(tctx->cached_refs);
|
||||
|
||||
kfree(tctx->registered_rings);
|
||||
percpu_counter_destroy(&tctx->inflight);
|
||||
kfree(tctx);
|
||||
tsk->io_uring = NULL;
|
||||
@ -69,16 +68,8 @@ __cold int io_uring_alloc_task_context(struct task_struct *task,
|
||||
if (unlikely(!tctx))
|
||||
return -ENOMEM;
|
||||
|
||||
tctx->registered_rings = kcalloc(IO_RINGFD_REG_MAX,
|
||||
sizeof(struct file *), GFP_KERNEL);
|
||||
if (unlikely(!tctx->registered_rings)) {
|
||||
kfree(tctx);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = percpu_counter_init(&tctx->inflight, 0, GFP_KERNEL);
|
||||
if (unlikely(ret)) {
|
||||
kfree(tctx->registered_rings);
|
||||
kfree(tctx);
|
||||
return ret;
|
||||
}
|
||||
@ -87,7 +78,6 @@ __cold int io_uring_alloc_task_context(struct task_struct *task,
|
||||
if (IS_ERR(tctx->io_wq)) {
|
||||
ret = PTR_ERR(tctx->io_wq);
|
||||
percpu_counter_destroy(&tctx->inflight);
|
||||
kfree(tctx->registered_rings);
|
||||
kfree(tctx);
|
||||
return ret;
|
||||
}
|
||||
|
@ -20,8 +20,9 @@ struct io_uring_task {
|
||||
struct io_wq_work_list task_list;
|
||||
struct io_wq_work_list prio_task_list;
|
||||
struct callback_head task_work;
|
||||
struct file **registered_rings;
|
||||
bool task_running;
|
||||
|
||||
struct file *registered_rings[IO_RINGFD_REG_MAX];
|
||||
};
|
||||
|
||||
struct io_tctx_node {
|
||||
|
Loading…
Reference in New Issue
Block a user