On 3/13/24 13:55, Eric Dumazet wrote:
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
Yes. Using kfree_rcu() bypasses these (optional) debugging/consistency checks.
Your patch is not 'trivial' as you think.
You're shifting from "not going to work" to "not trivial" so nicely.
Otherwise, we will soon have dozen of patches submissions replacing kmem_cache_free() with kfree()
No. The question is about freeing on some (where the freeing callback function is trivial) RCU-protected paths only. Dmitry