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


Groups > linux.kernel > #1309027

[PATCH 12/16] mm/slab: do not change cache size if debug pagealloc isn't possible

From Joonsoo Kim <js1304@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 12/16] mm/slab: do not change cache size if debug pagealloc isn't possible
Date 2016-01-14 06:30 +0100
Message-ID <qQIDW-2oH-33@gated-at.bofh.it> (permalink)
References <qQIDU-2oH-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We can fail to setup off slab in some conditions. Even in this case,
debug pagealloc increases cache size to PAGE_SIZE in advance and
it is waste because debug pagealloc cannot work for it when it isn't
the off slab. To improve this situation, this patch checks first
that this cache with increased size is suitable for off slab.
It actually increases cache size when it is suitable for off-slab,
so possible waste is removed.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 mm/slab.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 7a253a9..b0f6eda 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2207,10 +2207,17 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
 	 */
 	if (debug_pagealloc_enabled() && (flags & SLAB_POISON) &&
 		!slab_early_init && size >= kmalloc_size(INDEX_NODE) &&
-		size >= 256 && cachep->object_size > cache_line_size() &&
-		size < PAGE_SIZE) {
-		cachep->obj_offset += PAGE_SIZE - size;
-		size = PAGE_SIZE;
+		size >= 256 && cachep->object_size > cache_line_size()) {
+		if (size < PAGE_SIZE || size % PAGE_SIZE == 0) {
+			size_t tmp_size = ALIGN(size, PAGE_SIZE);
+
+			if (set_off_slab_cache(cachep, tmp_size, flags)) {
+				flags |= CFLGS_OFF_SLAB;
+				cachep->obj_offset += tmp_size - size;
+				size = tmp_size;
+				goto done;
+			}
+		}
 	}
 #endif
 
-- 
1.9.1

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


Thread

[PATCH 00/16] mm/slab: introduce new freed objects management way, OBJFREELIST_SLAB Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
  [PATCH 01/16] mm/slab: fix stale code comment Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
    Re: [PATCH 01/16] mm/slab: fix stale code comment Christoph Lameter <cl@linux.com> - 2016-01-14 16:30 +0100
  [PATCH 06/16] mm/slab: clean-up DEBUG_PAGEALLOC processing code Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
  [PATCH 08/16] mm/slab: remove object status buffer for DEBUG_SLAB_LEAK Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
  [PATCH 09/16] mm/slab: put the freelist at the end of slab page Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
    Re: [PATCH 09/16] mm/slab: put the freelist at the end of slab  page Christoph Lameter <cl@linux.com> - 2016-01-14 16:40 +0100
      Re: [PATCH 09/16] mm/slab: put the freelist at the end of slab page Joonsoo Kim <js1304@gmail.com> - 2016-01-14 17:30 +0100
    Re: [PATCH 09/16] mm/slab: put the freelist at the end of slab  page Christoph Lameter <cl@linux.com> - 2016-01-14 18:20 +0100
  [PATCH 12/16] mm/slab: do not change cache size if debug pagealloc isn't possible Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
  [PATCH 14/16] mm/slab: factor out slab list fixup code Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100

csiph-web