[PATCH net-next] wireguard: Using kfree_rcu() to simplify the code

Jason A. Donenfeld Jason at zx2c4.com
Thu Dec 12 14:18:39 CET 2019


Hi Wei,

On Thu, Dec 12, 2019 at 1:03 PM Wei Yongjun <weiyongjun1 at huawei.com> wrote:
> The callback function of call_rcu() just calls a kfree(), so we
> can use kfree_rcu() instead of call_rcu() + callback function.
>
> Signed-off-by: Wei Yongjun <weiyongjun1 at huawei.com>

Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>

I've queued this up as:
https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/wireguard-linux.git/commit/?id=2ddefeb5872878fe2fffb83664c02bd104fb1a52
I'll submit this to net-next next week as part of a cleanup series I'm
preparing.

In case you're curious, this originally was call_rcu_bh, as there was
no kfree_rcu_bh function. Since the _bh functions got unified a few
releases ago, this was changed to just a simple call_rcu, but
apparently missed the optimization you've done here using kfree_rcu.
So thanks for the patch.

Regards,
Jason


More information about the WireGuard mailing list