On Wed, Mar 13, 2024 at 11:28 AM Dmitry Antipov <dmantipov@xxxxxxxxx> 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()