[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <21A10014-22D8-4107-8C6C-14102478D19B@joelfernandes.org>
Date: Fri, 2 Dec 2022 19:28:31 -0500
From: Joel Fernandes <joel@...lfernandes.org>
To: paulmck@...nel.org
Cc: Eric Dumazet <edumazet@...gle.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
eric.dumazet@...il.com, Dmitry Safonov <dima@...sta.com>,
rcu@...r.kernel.org
Subject: Re: [PATCH net-next] tcp: use 2-arg optimal variant of kfree_rcu()
+rcu for archives
> On Dec 2, 2022, at 7:16 PM, Joel Fernandes <joel@...lfernandes.org> wrote:
>
> On Sat, Dec 3, 2022 at 12:12 AM Joel Fernandes <joel@...lfernandes.org> wrote:
>>
>>> On Sat, Dec 3, 2022 at 12:03 AM Paul E. McKenney <paulmck@...nel.org> wrote:
>>>
>>> On Fri, Dec 02, 2022 at 11:49:59PM +0000, Joel Fernandes wrote:
>>>> On Fri, Dec 02, 2022 at 05:28:47AM +0000, Eric Dumazet wrote:
>>>>> kfree_rcu(1-arg) should be avoided as much as possible,
>>>>> since this is only possible from sleepable contexts,
>>>>> and incurr extra rcu barriers.
>>>>>
>>>>> I wish the 1-arg variant of kfree_rcu() would
>>>>> get a distinct name, like kfree_rcu_slow()
>>>>> to avoid it being abused.
>>>>
>>>> Hi Eric,
>>>> Nice to see your patch.
>>>>
>>>> Paul, all, regarding Eric's concern, would the following work to warn of
>>>> users? Credit to Paul/others for discussing the idea on another thread. One
>>>> thing to note here is, this debugging will only be in effect on preemptible
>>>> kernels, but should still help catch issues hopefully.
>>>
>>> Mightn't there be some places where someone needs to invoke
>>> single-argument kfree_rcu() in a preemptible context, for example,
>>> due to the RCU-protected structure being very small and very numerous?
>>
>> This could be possible but I am not able to find examples of such
>> cases, at the moment. Another approach could be to introduce a
>> dedicated API for such cases, where the warning will not fire. And
>> keep the warning otherwise.
>>
>> Example: kfree_rcu_headless()
>> With a big comment saying, use only if you are calling from a
>> preemptible context and cannot absolutely embed an rcu_head. :-)
>>
>> Thoughts?
>>
>
> Just to clarify, where I was getting at was to combine both ideas:
> 1. new API with suppression of the new warning mentioned above.
> 2. old API but add new warning mentioned above.
>
> Cheers,
>
> - Joel
Powered by blists - more mailing lists