Skip to content

Commit

Permalink
mm: sl[uo]b: fix misleading comments
Browse files Browse the repository at this point in the history
On x86, SLUB creates and handles <=8192-byte allocations internally.
It passes larger ones up to the allocator.  Saying "up to order 2" is,
at best, ambiguous.  Is that order-1?  Or (order-2 bytes)?  Make
it more clear.

SLOB commits a similar sin.  It *handles* page-size requests, but the
comment says that it passes up "all page size and larger requests".

SLOB also swaps around the order of the very-similarly-named
KMALLOC_SHIFT_HIGH and KMALLOC_SHIFT_MAX #defines.  Make it
consistent with the order of the other two allocators.

Cc: Matt Mackall <[email protected]>
Cc: Andrew Morton <[email protected]>
Acked-by: Christoph Lameter <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
  • Loading branch information
hansendc authored and penberg committed Jan 31, 2014
1 parent 26e4f20 commit 433a91f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/linux/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ struct kmem_cache {

#ifdef CONFIG_SLUB
/*
* SLUB allocates up to order 2 pages directly and otherwise
* passes the request to the page allocator.
* SLUB directly allocates requests fitting in to an order-1 page
* (PAGE_SIZE*2). Larger requests are passed to the page allocator.
*/
#define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1)
#define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT)
Expand All @@ -217,12 +217,12 @@ struct kmem_cache {

#ifdef CONFIG_SLOB
/*
* SLOB passes all page size and larger requests to the page allocator.
* SLOB passes all requests larger than one page to the page allocator.
* No kmalloc array is necessary since objects of different sizes can
* be allocated from the same page.
*/
#define KMALLOC_SHIFT_MAX 30
#define KMALLOC_SHIFT_HIGH PAGE_SHIFT
#define KMALLOC_SHIFT_MAX 30
#ifndef KMALLOC_SHIFT_LOW
#define KMALLOC_SHIFT_LOW 3
#endif
Expand Down

0 comments on commit 433a91f

Please sign in to comment.