From: Christoph Lameter Date: Thu, 9 Oct 2014 22:26:11 +0000 (-0700) Subject: slub: disable tracing and failslab for merged slabs X-Git-Tag: v3.18-rc1~108^2~116 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=c9e16131d6e39bddd183f0b9d787ec0a62bf0eeb;p=~emulex%2Finfiniband.git slub: disable tracing and failslab for merged slabs Tracing of mergeable slabs as well as uses of failslab are confusing since the objects of multiple slab caches will be affected. Moreover this creates a situation where a mergeable slab will become unmergeable. If tracing or failslab testing is desired then it may be best to switch merging off for starters. Signed-off-by: Christoph Lameter Tested-by: WANG Chao Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slub.c b/mm/slub.c index 3e8afcc07a7..fa86e584509 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4604,6 +4604,14 @@ static ssize_t trace_show(struct kmem_cache *s, char *buf) static ssize_t trace_store(struct kmem_cache *s, const char *buf, size_t length) { + /* + * Tracing a merged cache is going to give confusing results + * as well as cause other issues like converting a mergeable + * cache into an umergeable one. + */ + if (s->refcount > 1) + return -EINVAL; + s->flags &= ~SLAB_TRACE; if (buf[0] == '1') { s->flags &= ~__CMPXCHG_DOUBLE; @@ -4721,6 +4729,9 @@ static ssize_t failslab_show(struct kmem_cache *s, char *buf) static ssize_t failslab_store(struct kmem_cache *s, const char *buf, size_t length) { + if (s->refcount > 1) + return -EINVAL; + s->flags &= ~SLAB_FAILSLAB; if (buf[0] == '1') s->flags |= SLAB_FAILSLAB;