[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJNBHnCPNovYE9tjQT1eN4DE-OFOhE9P86xX_F0HxWfrQ@mail.gmail.com>
Date: Wed, 13 Mar 2024 11:55:40 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Dmitry Antipov <dmantipov@...dex.ru>
Cc: Oliver Hartkopp <socketcan@...tkopp.net>, Marc Kleine-Budde <mkl@...gutronix.de>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] can: gw: prefer kfree_rcu() over call_rcu() with cgw_job_free_rcu()
On Wed, Mar 13, 2024 at 11:28 AM Dmitry Antipov <dmantipov@...dex.ru> wrote:
>
> On 3/13/24 13:18, Eric Dumazet wrote:
>
> > kmem_cache_free() is not the same than kfree()
> >
> > Unless I have missed something in mm territory , your patch is not
> > going to work.
>
> Hm... it seems that you're better to check include/linux/rcupdate.h
> and the comment before kfree_rcu() definition in particular.
>
Replacing call_rcu() + free() by kfree_rcu() is what is documented.
Again, kfree() is different from kmem_cache_free().
kmem_cache_free(struct kmem_cache *s, void *x) has additional checks
to make sure the object @x was allocated
from the @s kmem_cache.
Look for SLAB_CONSISTENCY_CHECKS and CONFIG_SLAB_FREELIST_HARDENED
Your patch is not 'trivial' as you think.
Otherwise, we will soon have dozen of patches submissions replacing
kmem_cache_free() with kfree()
Powered by blists - more mailing lists