lkml.org 
[lkml]   [2011]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 3/3] slub: min order when corrupt_dbg
Date
Disable slub debug facilities and allocate slabs at minimal order when
corrupt_dbg > 0 to increase probability to catch random memory
corruption by cpu exception.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
mm/slub.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 7c54fe8..fec88b5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2755,7 +2755,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
unsigned long flags = s->flags;
unsigned long size = s->objsize;
unsigned long align = s->align;
- int order;
+ int order, min_order;

/*
* Round up object size to the next word boundary. We can only
@@ -2840,8 +2840,11 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
*/
size = ALIGN(size, align);
s->size = size;
+ min_order = get_order(size);
if (forced_order >= 0)
order = forced_order;
+ else if (corrupt_dbg())
+ order = min_order;
else
order = calculate_order(size, s->reserved);

@@ -2862,7 +2865,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
* Determine the number of objects per slab
*/
s->oo = oo_make(order, size, s->reserved);
- s->min = oo_make(get_order(size), size, s->reserved);
+ s->min = oo_make(min_order, size, s->reserved);
if (oo_objects(s->oo) > oo_objects(s->max))
s->max = s->oo;

@@ -3529,6 +3532,9 @@ void __init kmem_cache_init(void)
struct kmem_cache *temp_kmem_cache_node;
unsigned long kmalloc_size;

+ if (corrupt_dbg())
+ slub_debug = 0;
+
kmem_size = offsetof(struct kmem_cache, node) +
nr_node_ids * sizeof(struct kmem_cache_node *);

--
1.7.1


\
 
 \ /
  Last update: 2011-10-17 16:23    [W:0.028 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site