Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1343803

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

From js1304@gmail.com
Newsgroups linux.kernel
Subject [PATCH v2 04/17] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled
Date 2016-02-26 07:10 +0100
Message-ID <r6jLc-7pr-19@gated-at.bofh.it> (permalink)
References <r6jLb-7pr-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: 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>
---
 mm/slab.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 14c3f9c..4807cf4 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);
 #endif
 	}
@@ -2716,7 +2719,8 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
 	set_obj_status(page, objnr, OBJECT_FREE);
 	if (cachep->flags & SLAB_POISON) {
 #ifdef CONFIG_DEBUG_PAGEALLOC
-		if ((cachep->size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) {
+		if (debug_pagealloc_enabled() &&
+			(cachep->size % PAGE_SIZE) == 0 && OFF_SLAB(cachep)) {
 			store_stackinfo(cachep, objp, caller);
 			kernel_map_pages(virt_to_page(objp),
 					 cachep->size / PAGE_SIZE, 0);
@@ -2861,7 +2865,8 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
 		return objp;
 	if (cachep->flags & SLAB_POISON) {
 #ifdef CONFIG_DEBUG_PAGEALLOC
-		if ((cachep->size % PAGE_SIZE) == 0 && OFF_SLAB(cachep))
+		if (debug_pagealloc_enabled() &&
+			(cachep->size % PAGE_SIZE) == 0 && OFF_SLAB(cachep))
 			kernel_map_pages(virt_to_page(objp),
 					 cachep->size / PAGE_SIZE, 1);
 		else
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/17] mm/slab: introduce new freed objects management way, OBJFREELIST_SLAB js1304@gmail.com - 2016-02-26 07:10 +0100
  [PATCH v2 16/17] mm/slab: introduce new slab management type, OBJFREELIST_SLAB js1304@gmail.com - 2016-02-26 07:10 +0100
    Re: [PATCH v2 16/17] mm/slab: introduce new slab management type,  OBJFREELIST_SLAB Christoph Lameter <cl@linux.com> - 2016-02-26 17:30 +0100
      Re: [PATCH v2 16/17] mm/slab: introduce new slab management type, OBJFREELIST_SLAB Joonsoo Kim <js1304@gmail.com> - 2016-02-26 18:10 +0100
  [PATCH v2 11/17] mm/slab: clean up cache type determination js1304@gmail.com - 2016-02-26 07:10 +0100
  [PATCH v2 03/17] mm/slab: remove the checks for slab implementation bug js1304@gmail.com - 2016-02-26 07:10 +0100
    Re: [PATCH v2 03/17] mm/slab: remove the checks for slab implementation  bug Christoph Lameter <cl@linux.com> - 2016-02-26 17:10 +0100
  [PATCH v2 01/17] mm/slab: fix stale code comment js1304@gmail.com - 2016-02-26 07:10 +0100
  [PATCH v2 04/17] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled js1304@gmail.com - 2016-02-26 07:10 +0100
    Re: [PATCH v2 04/17] mm/slab: activate debug_pagealloc in SLAB when  it is actually enabled Christoph Lameter <cl@linux.com> - 2016-02-26 17:10 +0100
  [PATCH v2 05/17] mm/slab: use more appropriate condition check for debug_pagealloc js1304@gmail.com - 2016-02-26 07:10 +0100
    Re: [PATCH v2 05/17] mm/slab: use more appropriate condition check  for debug_pagealloc Christoph Lameter <cl@linux.com> - 2016-02-26 17:10 +0100
  [PATCH v2 09/17] mm/slab: put the freelist at the end of slab page js1304@gmail.com - 2016-02-26 07:10 +0100
  [PATCH v2 07/17] mm/slab: alternative implementation for DEBUG_SLAB_LEAK js1304@gmail.com - 2016-02-26 07:10 +0100
  [PATCH v2 13/17] mm/slab: make criteria for off slab determination robust and simple js1304@gmail.com - 2016-02-26 07:10 +0100
  [PATCH v2 12/17] mm/slab: do not change cache size if debug pagealloc isn't possible js1304@gmail.com - 2016-02-26 07:10 +0100
    Re: [PATCH v2 12/17] mm/slab: do not change cache size if debug  pagealloc isn't possible Christoph Lameter <cl@linux.com> - 2016-02-26 17:20 +0100
      Re: [PATCH v2 12/17] mm/slab: do not change cache size if debug  pagealloc isn't possible Joonsoo Kim <js1304@gmail.com> - 2016-02-26 18:10 +0100
  [PATCH v2 17/17] mm/slab: avoid returning values by reference js1304@gmail.com - 2016-02-26 07:10 +0100
    Re: [PATCH v2 17/17] mm/slab: avoid returning values by reference Christoph Lameter <cl@linux.com> - 2016-02-26 17:30 +0100
  [PATCH v2 06/17] mm/slab: clean up DEBUG_PAGEALLOC processing code js1304@gmail.com - 2016-02-26 07:10 +0100
  [PATCH v2 08/17] mm/slab: remove object status buffer for DEBUG_SLAB_LEAK js1304@gmail.com - 2016-02-26 07:10 +0100

csiph-web