提交 03f697f1 编写于 作者: Y YueHaibing 提交者: Joseph Qi

io-wq: use kfree_rcu() to simplify the code

commit 364b05fd06e87e53dc03396f73afeac48d8e0998 upstream.

The callback function of call_rcu() just calls kfree(), so we can use
kfree_rcu() instead of call_rcu() + callback function.
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 2a04befa
......@@ -102,13 +102,6 @@ struct io_wq {
struct completion done;
};
static void io_wq_free_worker(struct rcu_head *head)
{
struct io_worker *worker = container_of(head, struct io_worker, rcu);
kfree(worker);
}
static bool io_worker_get(struct io_worker *worker)
{
return refcount_inc_not_zero(&worker->ref);
......@@ -194,7 +187,7 @@ static void io_worker_exit(struct io_worker *worker)
if (all_done && refcount_dec_and_test(&wqe->wq->refs))
complete(&wqe->wq->done);
call_rcu(&worker->rcu, io_wq_free_worker);
kfree_rcu(worker, rcu);
}
static void io_worker_start(struct io_wqe *wqe, struct io_worker *worker)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册