Skip to content

Commit c9e1613

Browse files
Christoph Lametertorvalds
authored andcommitted
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 <[email protected]> Tested-by: WANG Chao <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: David Rientjes <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 25c4f30 commit c9e1613

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mm/slub.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4604,6 +4604,14 @@ static ssize_t trace_show(struct kmem_cache *s, char *buf)
46044604
static ssize_t trace_store(struct kmem_cache *s, const char *buf,
46054605
size_t length)
46064606
{
4607+
/*
4608+
* Tracing a merged cache is going to give confusing results
4609+
* as well as cause other issues like converting a mergeable
4610+
* cache into an umergeable one.
4611+
*/
4612+
if (s->refcount > 1)
4613+
return -EINVAL;
4614+
46074615
s->flags &= ~SLAB_TRACE;
46084616
if (buf[0] == '1') {
46094617
s->flags &= ~__CMPXCHG_DOUBLE;
@@ -4721,6 +4729,9 @@ static ssize_t failslab_show(struct kmem_cache *s, char *buf)
47214729
static ssize_t failslab_store(struct kmem_cache *s, const char *buf,
47224730
size_t length)
47234731
{
4732+
if (s->refcount > 1)
4733+
return -EINVAL;
4734+
47244735
s->flags &= ~SLAB_FAILSLAB;
47254736
if (buf[0] == '1')
47264737
s->flags |= SLAB_FAILSLAB;

0 commit comments

Comments
 (0)