Re: [PATCH] rust: slab: add basic slab module

Danilo Krummrich
2025-09-26T19:01:08Z

On Fri Sep 26, 2025 at 7:11 PM CEST, Vlastimil Babka wrote:
> The rust wrapper side could do that so we don't have to add that check in
> all kmem_cache_free() calls, maybe?
> Also either way it could perhaps be difficult/expensive (memory barriers
> etc) to properly handle a racing kmem_cache_free() and kmem_cache_destroy()
> in a way that ensures the cache is always being destroyed, and not have the
> kmem_cache_destroy() observe the destroy was premature, while the racing
> kmem_cache_free() doesn't yet observe that destroy was attempted, and not
> try to remove it.

Yeah, it's probably not much better than just using a reference count, but more
error prone.