Re: [PATCH] mm/slab: simplify SLAB_* flag handling
From: Christoph Lameter (Ampere)
Date: Fri Jan 17 2025 - 17:13:38 EST
On Fri, 17 Jan 2025, Kevin Brodsky wrote:
> index a29457bef626..3b07cdaac3ae 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -305,18 +305,6 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
> goto out_unlock;
> }
>
> - /* Refuse requests with allocator specific flags */
> - if (flags & ~SLAB_FLAGS_PERMITTED) {
> - err = -EINVAL;
> - goto out_unlock;
> - }
I think we should keep checking for invalid flags.
-
> - /*
> - * Some allocators will constraint the set of valid flags to a subset
> - * of all flags. We expect them to define CACHE_CREATE_MASK in this
> - * case, and we'll just provide them with a sanitized version of the
> - * passed flags.
> - */
> flags &= CACHE_CREATE_MASK;
This would silently clear some flags instead of creating an error.