* [PATCH -next] io-wq: using kfree_rcu() to simplify the code
@ 2019-11-02 7:55 YueHaibing
2019-11-02 13:59 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-11-02 7:55 UTC (permalink / raw)
To: viro, axboe; +Cc: linux-fsdevel, linux-kernel, YueHaibing
The callback function of call_rcu() just calls a kfree(),
so can use kfree_rcu() instead of call_rcu() + callback function.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
fs/io-wq.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/fs/io-wq.c b/fs/io-wq.c
index 652b8ba..3bbab2c 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -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)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] io-wq: using kfree_rcu() to simplify the code
2019-11-02 7:55 [PATCH -next] io-wq: using kfree_rcu() to simplify the code YueHaibing
@ 2019-11-02 13:59 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-11-02 13:59 UTC (permalink / raw)
To: YueHaibing, viro; +Cc: linux-fsdevel, linux-kernel
On 11/2/19 1:55 AM, YueHaibing wrote:
> The callback function of call_rcu() just calls a kfree(),
> so can use kfree_rcu() instead of call_rcu() + callback function.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-02 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-02 7:55 [PATCH -next] io-wq: using kfree_rcu() to simplify the code YueHaibing
2019-11-02 13:59 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).