From: "Theodore Ts'o" <tytso@mit.edu>
To: Joel Fernandes <joel@joelfernandes.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Uladzislau Rezki <urezki@gmail.com>, Jens Axboe <axboe@kernel.dk>,
LKML <linux-kernel@vger.kernel.org>, RCU <rcu@vger.kernel.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>,
Philipp Reisner <philipp.reisner@linbit.com>,
Bryan Tan <bryantan@vmware.com>,
Eric Dumazet <edumazet@google.com>,
Bob Pearson <rpearsonhpe@gmail.com>,
Ariel Levkovich <lariel@nvidia.com>, Julian Anastasov <ja@ssi.bg>
Subject: Re: [PATCH 00/13] Rename k[v]free_rcu() single argument to k[v]free_rcu_mightsleep()
Date: Wed, 15 Mar 2023 21:25:16 -0400 [thread overview]
Message-ID: <20230316012516.GK860405@mit.edu> (raw)
In-Reply-To: <CAEXW_YTNNJJftsg1QRvhUCRoZpKa3SM6=-0M-cukCGt5=G+row@mail.gmail.com>
On Wed, Mar 15, 2023 at 06:08:19PM -0400, Joel Fernandes wrote:
>
> I am doubtful there may be a future where it does not sleep. Why?
> Because you need an rcu_head *somewhere*.
I think the real problem was that this won't sleep:
kfree_rcu(ptr, rhf);
While this *could* sleep:
kfree_rcu(ptr);
So the the original sin was to try to make the same mistake that C++
did --- which is to think that it's good to have functions that have
the same name but different function signatures, and in some cases,
different semantic meanings because they have different implementations.
Personally, this is why I refuse to use C++ for any of my personal
projects --- this kind of "magic" looks good, but it's a great way to
potentially shoot yourself (or worse, your users) in the foot.
So separating out the two-argument kfree_rcu() from the one-argument
kfree_rcu(), by renaming the latter to something else is IMHO, a
Really F***** Good Idea. So while, sure, kfree_rcu_mightsleep() might
be a little awkward, the name documents the potential landmind
involved with using that function, that's a good thing. Because do
you really think users will always conscientiously check the
documentation and/or the implementation before using the interface? :-)
If you hate that name, one other possibility is to try to use the
two-argument form kfree_rcu() and arrange to *have* a rcu_head in the
structure. That's going to be better from a performance perspective,
and thus kinder to the end user than using rcu_synchronize().
Cheers,
- Ted
next prev parent reply other threads:[~2023-03-16 1:25 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 15:08 [PATCH 00/13] Rename k[v]free_rcu() single argument to k[v]free_rcu_mightsleep() Uladzislau Rezki (Sony)
2023-02-01 15:08 ` [PATCH 01/13] rcu/kvfree: Add kvfree_rcu_mightsleep() and kfree_rcu_mightsleep() Uladzislau Rezki (Sony)
2023-02-02 7:54 ` Zhuo, Qiuxu
2023-02-02 15:07 ` Paul E. McKenney
2023-02-01 15:08 ` [PATCH 02/13] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Uladzislau Rezki (Sony)
2023-03-09 13:39 ` Uladzislau Rezki
2023-02-01 15:08 ` [PATCH 03/13] misc: vmw_vmci: " Uladzislau Rezki (Sony)
2023-03-09 13:41 ` Uladzislau Rezki
2023-03-09 14:36 ` Vishnu Dasa
2023-02-01 15:08 ` [PATCH 04/13] tracing: " Uladzislau Rezki (Sony)
2023-03-09 13:45 ` Uladzislau Rezki
2023-03-15 22:36 ` Steven Rostedt
2023-03-15 23:19 ` Jens Axboe
2023-03-16 0:37 ` Paul E. McKenney
2023-03-16 2:23 ` Steven Rostedt
2023-03-16 3:44 ` Paul E. McKenney
2023-03-16 4:16 ` Joel Fernandes
2023-03-16 12:14 ` Steven Rostedt
2023-03-16 14:56 ` Paul E. McKenney
2023-03-16 8:16 ` Uladzislau Rezki
2023-03-16 13:56 ` Steven Rostedt
2023-03-16 15:05 ` Uladzislau Rezki
2023-03-17 9:05 ` Uladzislau Rezki
2023-03-16 15:12 ` Paul E. McKenney
2023-03-16 17:54 ` Paul E. McKenney
2023-03-16 17:57 ` Uladzislau Rezki
2023-03-16 18:01 ` Joel Fernandes
2023-03-18 16:11 ` Steven Rostedt
2023-03-22 23:10 ` Joel Fernandes
2023-02-01 15:08 ` [PATCH 05/13] lib/test_vmalloc.c: " Uladzislau Rezki (Sony)
2023-02-01 15:08 ` [PATCH 06/13] net/sysctl: " Uladzislau Rezki (Sony)
2023-03-09 13:48 ` Uladzislau Rezki
2023-03-09 13:49 ` Uladzislau Rezki
2023-02-01 15:08 ` [PATCH 07/13] RDMA/rxe: Rename kfree_rcu() to kfree_rcu_mightsleep() Uladzislau Rezki (Sony)
2023-03-09 13:48 ` Uladzislau Rezki
2023-03-09 14:13 ` Uladzislau Rezki
2023-03-10 0:55 ` Joel Fernandes
2023-03-13 19:43 ` Bob Pearson
2023-03-15 11:50 ` Joel Fernandes
2023-03-15 18:07 ` Bob Pearson
2023-03-14 6:31 ` Zhu Yanjun
2023-02-01 15:08 ` [PATCH 08/13] net/mlx5: " Uladzislau Rezki (Sony)
2023-03-09 13:47 ` Uladzislau Rezki
2023-02-01 15:08 ` [PATCH 09/13] ext4/super: " Uladzislau Rezki (Sony)
2023-03-09 13:43 ` Uladzislau Rezki
2023-02-01 19:12 ` [PATCH 00/13] Rename k[v]free_rcu() single argument to k[v]free_rcu_mightsleep() Paul E. McKenney
2023-02-02 15:54 ` Uladzislau Rezki
2023-02-02 16:35 ` Paul E. McKenney
2023-02-23 12:45 ` Frederic Weisbecker
2023-02-23 14:29 ` Zhuo, Qiuxu
2023-02-23 15:54 ` Paul E. McKenney
2023-02-23 16:21 ` Julian Anastasov
2023-02-23 17:14 ` Paul E. McKenney
2023-02-23 17:36 ` Pablo Neira Ayuso
2023-02-23 18:21 ` Paul E. McKenney
2023-02-23 14:57 ` Jens Axboe
2023-02-23 18:31 ` Paul E. McKenney
2023-02-23 19:36 ` Jens Axboe
2023-02-23 19:47 ` Paul E. McKenney
2023-02-23 19:57 ` Jens Axboe
2023-03-15 19:14 ` Steven Rostedt
2023-03-15 19:16 ` Jens Axboe
2023-03-15 19:25 ` Uladzislau Rezki
2023-03-15 19:34 ` Steven Rostedt
2023-03-15 19:57 ` Joel Fernandes
2023-03-15 20:28 ` Steven Rostedt
2023-03-15 21:07 ` Uladzislau Rezki
2023-03-15 21:14 ` Uladzislau Rezki
2023-03-15 22:08 ` Joel Fernandes
2023-03-15 22:26 ` Steven Rostedt
2023-03-16 2:13 ` Joel Fernandes
2023-03-16 2:50 ` Steven Rostedt
2023-03-16 5:01 ` Joel Fernandes
2023-03-16 1:25 ` Theodore Ts'o [this message]
2023-03-16 2:15 ` Steven Rostedt
2023-03-16 2:52 ` Paul E. McKenney
2023-03-16 0:42 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230316012516.GK860405@mit.edu \
--to=tytso@mit.edu \
--cc=axboe@kernel.dk \
--cc=bryantan@vmware.com \
--cc=edumazet@google.com \
--cc=ja@ssi.bg \
--cc=joel@joelfernandes.org \
--cc=lariel@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleksiy.avramchenko@sony.com \
--cc=paulmck@kernel.org \
--cc=philipp.reisner@linbit.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=rpearsonhpe@gmail.com \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox