lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTinxNbBQ3phKH8aoOSCO-+3FLn=te4OAqx4J8cU+@mail.gmail.com>
Date:	Tue, 14 Sep 2010 20:10:55 +0300
From:	Pekka Enberg <penberg@...nel.org>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, Pekka Enberg <penberg@...nel.org>,
	Christoph Lameter <cl@...ux.com>,
	David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH 2/2] SLUB: Mark merged slab caches in /proc/slabinfo

On Tue, Sep 14, 2010 at 8:06 PM, Pekka Enberg <penberg@...nel.org> wrote:
> SLUB uses the name of the first slab cache for all merged slab caches. To make
> the output of /proc/slabinfo more obvious, append the name of each merged slab
> cache to s->name.
>
> An example output looks like this:
>
>  bip-16,ip_dst_cache,kioctx     42     42    [snip]
>
> Cc: Christoph Lameter <cl@...ux.com>
> Cc: David Rientjes <rientjes@...gle.com>
> Reported-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Pekka Enberg <penberg@...nel.org>

Unfortunately this breaks "slabtop". I guess we could try some other delimiter?

> ---
>  mm/slub.c |   41 ++++++++++++++++++++++++++++++-----------
>  1 files changed, 30 insertions(+), 11 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 0704288..6b08256 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3149,6 +3149,34 @@ void __init kmem_cache_init_late(void)
>  {
>  }
>
> +static int kmem_merge_names(struct kmem_cache *s, const char *name)
> +{
> +       size_t new_size;
> +       char *new_name;
> +
> +       /* Don't append name to merged name more than once */
> +       if (strstr(s->name, name))
> +               return 0;
> +
> +       /* Comma separated and NULL terminated. */
> +       new_size = strlen(s->name) + strlen(name) + 2;
> +
> +       new_name = kmalloc(new_size, GFP_KERNEL);
> +       if (!new_name)
> +               return -ENOMEM;
> +
> +       snprintf(new_name, new_size, "%s,%s", s->name, name);
> +
> +       if (s->flags & SLAB_DYNAMIC_NAME)
> +               kfree(s->name);
> +
> +       s->name = new_name;
> +
> +       s->flags |= SLAB_DYNAMIC_NAME;
> +
> +       return 0;
> +}
> +
>  /*
>  * Find a mergeable slab cache
>  */
> @@ -3221,17 +3249,8 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
>        down_write(&slub_lock);
>        s = find_mergeable(size, align, flags, name, ctor);
>        if (s) {
> -               if (!(s->flags & SLAB_DYNAMIC_NAME)) {
> -                       const char *new_name;
> -
> -                       new_name = kstrdup(s->name, GFP_KERNEL);
> -                       if (!new_name)
> -                               goto err;
> -
> -                       s->name = new_name;
> -
> -                       s->flags |= SLAB_DYNAMIC_NAME;
> -               }
> +               if (kmem_merge_names(s, name))
> +                       goto err;
>
>                s->refcount++;
>                /*
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ