mm/slub: query dynamic DEBUG_PAGEALLOC setting
authorJoonsoo Kim <[email protected]>
Thu, 17 Mar 2016 21:17:53 +0000 (14:17 -0700)
committerLinus Torvalds <[email protected]>
Thu, 17 Mar 2016 22:09:34 +0000 (15:09 -0700)
We can disable debug_pagealloc processing even if the code is compiled
with CONFIG_DEBUG_PAGEALLOC.  This patch changes the code to query
whether it is enabled or not in runtime.

[[email protected]: clean up code, per Christian]
Signed-off-by: Joonsoo Kim <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Takashi Iwai <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/slub.c

index 712d53474082a5725405b4c3ac8ca214ac95b0e4..2f2f04d39104e9769d01be4bca4dffa3da607a20 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -254,11 +254,10 @@ static inline void *get_freepointer_safe(struct kmem_cache *s, void *object)
 {
        void *p;
 
-#ifdef CONFIG_DEBUG_PAGEALLOC
+       if (!debug_pagealloc_enabled())
+               return get_freepointer(s, object);
+
        probe_kernel_read(&p, (void **)(object + s->offset), sizeof(p));
-#else
-       p = get_freepointer(s, object);
-#endif
        return p;
 }