Re: [PATCH] slub: do not merge cache if slub_debug contains a never-merge flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 23 Dec 2016, Grygorii Maistrenko wrote:

> In case CONFIG_SLUB_DEBUG_ON=n find_mergeable() gets debug features
> from commandline but never checks if there are features from the
> SLAB_NEVER_MERGE set.
> As a result selected by slub_debug caches are always mergeable if they
> have been created without a custom constructor set or without one of the
> SLAB_* debug features on.

WTF is this nonsense? That check is done a few lines earlier!

struct kmem_cache *ind_mergeable(size_t size, size_t align,
                unsigned long flags, const char *name, void (*ctor)(void *))
{
        struct kmem_cache *s;

        if (slab_nomerge || (flags & SLAB_NEVER_MERGE))    <----- !!!!!!
                return NULL;

        if (ctor)
                return NULL;

        size = ALIGN(size, sizeof(void *));
        align = calculate_alignment(flags,


>
> This adds the necessary check and makes selected slab caches unmergeable
> if one of the SLAB_NEVER_MERGE features is set from commandline.
>
> Signed-off-by: Grygorii Maistrenko <grygoriimkd@xxxxxxxxx>
> ---
>  mm/slab_common.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 329b03843863..7341cba8c58b 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
>  	size = ALIGN(size, align);
>  	flags = kmem_cache_flags(size, flags, name, NULL);
>
> +	if (flags & SLAB_NEVER_MERGE)
> +		return NULL;
> +
>  	list_for_each_entry_reverse(s, &slab_caches, list) {
>  		if (slab_unmergeable(s))
>  			continue;
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]