On 8/27/24 17:45, Jens Axboe wrote: > On 8/27/24 9:33 AM, Jann Horn wrote: > > Yep should work. > > I like this approach as a way of unifying the various ways of creating a > slab cache. Particularly as I'd want to use a free ptr myself for an > in-kernel use case that currently creates a cache with > kmem_cache_create_usercopy(). Ah right so you need effectively a combination of the current kmem_cache_create_usercopy() and kmem_cache_create_rcu(). >> But I guess if we want to allow leaving out the freeptr_offset >> parameter, we'd have to have a flag to say whether the freeptr_offset >> parameter value should be used... Maybe my proposal is too overly >> fancy... I think it's a good way. The extra flag to denote the custom freepointer offset is valid is a bit annoying, but there shouldn't be too many users of that, and implicit zero-initializing is a nice thing otherwise. > > I think we'll end up going down that route eventually anyway to cover > all cases, so may as well do a prep patch that does that first. At least > that's my opinion... >