Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283404
b: refs/heads/master
c: 3df1ccc
h: refs/heads/master
v: v3
  • Loading branch information
David Rientjes authored and Pekka Enberg committed Nov 10, 2011
1 parent 251d3fd commit d417ee9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 543585cc5b07fa99a2dc897159fbf48c1eb73058
refs/heads/master: 3df1cccdfb3fab6aa9176beb655d802eb384eabc
6 changes: 6 additions & 0 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.

slram= [HW,MTD]

slab_max_order= [MM, SLAB]
Determines the maximum allowed order for slabs.
A high setting may cause OOMs due to memory
fragmentation. Defaults to 1 for systems with
more than 32MB of RAM, 0 otherwise.

slub_debug[=options[,slabs]] [MM, SLUB]
Enabling slub_debug allows one to determine the
culprit if slab objects become corrupted. Enabling
Expand Down
20 changes: 17 additions & 3 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,13 @@ EXPORT_SYMBOL(slab_buffer_size);
#endif

/*
* Do not go above this order unless 0 objects fit into the slab.
* Do not go above this order unless 0 objects fit into the slab or
* overridden on the command line.
*/
#define SLAB_MAX_ORDER_HI 1
#define SLAB_MAX_ORDER_LO 0
static int slab_max_order = SLAB_MAX_ORDER_LO;
static bool slab_max_order_set __initdata;

/*
* Functions for storing/retrieving the cachep and or slab from the page
Expand Down Expand Up @@ -851,6 +853,17 @@ static int __init noaliencache_setup(char *s)
}
__setup("noaliencache", noaliencache_setup);

static int __init slab_max_order_setup(char *str)
{
get_option(&str, &slab_max_order);
slab_max_order = slab_max_order < 0 ? 0 :
min(slab_max_order, MAX_ORDER - 1);
slab_max_order_set = true;

return 1;
}
__setup("slab_max_order=", slab_max_order_setup);

#ifdef CONFIG_NUMA
/*
* Special reaping functions for NUMA systems called from cache_reap().
Expand Down Expand Up @@ -1499,9 +1512,10 @@ void __init kmem_cache_init(void)

/*
* Fragmentation resistance on low memory - only use bigger
* page orders on machines with more than 32MB of memory.
* page orders on machines with more than 32MB of memory if
* not overridden on the command line.
*/
if (totalram_pages > (32 << 20) >> PAGE_SHIFT)
if (!slab_max_order_set && totalram_pages > (32 << 20) >> PAGE_SHIFT)
slab_max_order = SLAB_MAX_ORDER_HI;

/* Bootstrap is tricky, because several objects are allocated
Expand Down

0 comments on commit d417ee9

Please sign in to comment.