Skip to content

Commit f7cd74f

Browse files
JoonsooKimAKASHI Takahiro
authored andcommitted
mm/slab: use more appropriate condition check for debug_pagealloc
debug_pagealloc debugging is related to SLAB_POISON flag rather than FORCED_DEBUG option, although FORCED_DEBUG option will enable SLAB_POISON. Fix it. Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Acked-by: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9452a80 commit f7cd74f

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

mm/slab.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,22 +2180,20 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
21802180
else
21812181
size += BYTES_PER_WORD;
21822182
}
2183-
#if FORCED_DEBUG && defined(CONFIG_DEBUG_PAGEALLOC)
21842183
/*
21852184
* To activate debug pagealloc, off-slab management is necessary
21862185
* requirement. In early phase of initialization, small sized slab
21872186
* doesn't get initialized so it would not be possible. So, we need
21882187
* to check size >= 256. It guarantees that all necessary small
21892188
* sized slab is initialized in current slab initialization sequence.
21902189
*/
2191-
if (debug_pagealloc_enabled() &&
2190+
if (debug_pagealloc_enabled() && (flags & SLAB_POISON) &&
21922191
!slab_early_init && size >= kmalloc_size(INDEX_NODE) &&
21932192
size >= 256 && cachep->object_size > cache_line_size() &&
21942193
ALIGN(size, cachep->align) < PAGE_SIZE) {
21952194
cachep->obj_offset += PAGE_SIZE - ALIGN(size, cachep->align);
21962195
size = PAGE_SIZE;
21972196
}
2198-
#endif
21992197
#endif
22002198

22012199
/*

0 commit comments

Comments
 (0)