]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
slub: disallow changing cpu_partial from userspace for debug caches
authorDavid Rientjes <rientjes@google.com>
Mon, 9 Jan 2012 21:19:45 +0000 (13:19 -0800)
committerPekka Enberg <penberg@kernel.org>
Tue, 10 Jan 2012 19:31:09 +0000 (21:31 +0200)
For caches with debugging enabled, "slub: Switch per cpu partial page
support off for debugging" changes cpu_partial to 0.  It shouldn't be
tunable from userspace for such caches, otherwise the same accounting
issues arise during validation.

This patch disallows tuning /sys/kernel/slab/cache/cpu_partial to be non-
zero for caches with debugging enabled.

Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slub.c

index 6dc79f8e6ce9764106505b44667713651deb2958..a47df0aa5d367c637de854de285c99ad9c96cfdd 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4649,6 +4649,8 @@ static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf,
        err = strict_strtoul(buf, 10, &objects);
        if (err)
                return err;
+       if (objects && kmem_cache_debug(s))
+               return -EINVAL;
 
        s->cpu_partial = objects;
        flush_all(s);