Skip to content

Commit

Permalink
mm: slub: Default slub_max_order to 0
Browse files Browse the repository at this point in the history
To avoid locking and per-cpu overhead, SLUB optimisically uses
high-order allocations up to order-3 by default and falls back to
lower allocations if they fail. While care is taken that the caller
and kswapd take no unusual steps in response to this, there are
further consequences like shrinkers who have to free more objects to
release any memory. There is anecdotal evidence that significant time
is being spent looping in shrinkers with insufficient progress being
made (https://lkml.org/lkml/2011/4/28/361) and keeping kswapd awake.

SLUB is now the default allocator and some bug reports have been
pinned down to SLUB using high orders during operations like
copying large amounts of data. SLUBs use of high-orders benefits
applications that are sized to memory appropriately but this does not
necessarily apply to large file servers or desktops.  This patch
causes SLUB to use order-0 pages like SLAB does by default.
There is further evidence that this keeps kswapd's usage lower
(https://lkml.org/lkml/2011/5/10/383).

Signed-off-by: Mel Gorman <[email protected]>
Signed-off-by: franciscofranco <[email protected]>
Signed-off-by: Ad!thya R <[email protected]>
  • Loading branch information
Mel Gorman authored and adithya2306 committed Nov 7, 2018
1 parent d89fdfc commit 3c3f0c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Documentation/vm/slub.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ can be influenced by kernel parameters:

slub_min_objects=x (default 4)
slub_min_order=x (default 0)
slub_max_order=x (default 3 (PAGE_ALLOC_COSTLY_ORDER))
slub_max_order=x (default 0)

slub_min_objects allows to specify how many objects must at least fit
into one slab in order for the allocation order to be acceptable.
Expand Down
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2669,7 +2669,7 @@ EXPORT_SYMBOL(kmem_cache_free);
* take the list_lock.
*/
static int slub_min_order;
static int slub_max_order = PAGE_ALLOC_COSTLY_ORDER;
static int slub_max_order;
static int slub_min_objects;

/*
Expand Down

0 comments on commit 3c3f0c7

Please sign in to comment.