Thread (36 messages) 36 messages, 6 authors, 2016-01-29

Re: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled

From: Joonsoo Kim <hidden>
Date: 2016-01-14 16:16:57
Also in: lkml

2016-01-14 21:09 GMT+09:00 Jesper Dangaard Brouer [off-list ref]:
On Thu, 14 Jan 2016 14:24:17 +0900
Joonsoo Kim [off-list ref] wrote:
quoted
Signed-off-by: Joonsoo Kim <redacted>
---
 mm/slab.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index bbe4df2..4b55516 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1838,7 +1838,8 @@ static void slab_destroy_debugcheck(struct kmem_cache *cachep,

              if (cachep->flags & SLAB_POISON) {
 #ifdef CONFIG_DEBUG_PAGEALLOC
-                     if (cachep->size % PAGE_SIZE == 0 &&
+                     if (debug_pagealloc_enabled() &&
+                             cachep->size % PAGE_SIZE == 0 &&
                                      OFF_SLAB(cachep))
                              kernel_map_pages(virt_to_page(objp),
                                      cachep->size / PAGE_SIZE, 1);
@@ -2176,7 +2177,8 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
       * to check size >= 256. It guarantees that all necessary small
       * sized slab is initialized in current slab initialization sequence.
       */
-     if (!slab_early_init && size >= kmalloc_size(INDEX_NODE) &&
+     if (debug_pagealloc_enabled() &&
+             !slab_early_init && size >= kmalloc_size(INDEX_NODE) &&
              size >= 256 && cachep->object_size > cache_line_size() &&
              ALIGN(size, cachep->align) < PAGE_SIZE) {
              cachep->obj_offset += PAGE_SIZE - ALIGN(size, cachep->align);
@@ -2232,7 +2234,8 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
               * poisoning, then it's going to smash the contents of
               * the redzone and userword anyhow, so switch them off.
               */
-             if (size % PAGE_SIZE == 0 && flags & SLAB_POISON)
+             if (debug_pagealloc_enabled() &&
+                     size % PAGE_SIZE == 0 && flags & SLAB_POISON)
                      flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
Sorry, but I dislike the indention style here (when the if covers
several lines). Same goes for other changes in this patch.  Looking,
there are several example of this indention style in the existing
mm/slab.c. Thus, I don't know if this is accepted in the MM area (it is
definitely not accepted in the NET-area).
I guess it is acceptable in the MM. :)
Moreover, it is cleaned-up in the following patch.
But, I hope to know how it is handled in the NET-area.

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