Thread (15 messages) 15 messages, 5 authors, 2016-02-09

Re: [PATCH 2/5] mm/slub: query dynamic DEBUG_PAGEALLOC setting

From: Joonsoo Kim <hidden>
Date: 2016-02-04 16:21:21
Also in: linux-mm, lkml

2016-02-04 17:31 GMT+09:00 Christian Borntraeger [off-list ref]:
On 02/04/2016 06:56 AM, Joonsoo Kim wrote:
quoted
We can disable debug_pagealloc processing even if the code is complied
with CONFIG_DEBUG_PAGEALLOC. This patch changes the code to query
whether it is enabled or not in runtime.

Signed-off-by: Joonsoo Kim <redacted>
---
 mm/slub.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 7d4da68..7b5a965 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -256,11 +256,12 @@ static inline void *get_freepointer_safe(struct kmem_cache *s, void *object)
 {
      void *p;

-#ifdef CONFIG_DEBUG_PAGEALLOC
-     probe_kernel_read(&p, (void **)(object + s->offset), sizeof(p));
-#else
-     p = get_freepointer(s, object);
-#endif
+     if (debug_pagealloc_enabled()) {
+             probe_kernel_read(&p,
+                     (void **)(object + s->offset), sizeof(p));
Hmm, this might be a good case for a line longer than 80 chars....

As an alternative revert the logic and return early:


        if (!debug_pagealloc_enabled())
                return get_freepointer(s, object);
        probe_kernel_read(&p, (void **)(object + s->offset), sizeof(p));
        return p;
Looks better!
I will fix it on next version.

Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help