summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-08 10:33:05 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-08 10:33:05 -0800
commitf78bb8ad482267b92c122f0e37a7dce69c880247 (patch)
tree0e43a4aabbf7a74c6253b1ecd30e3f6c8eccec43
parent7986824e4e31d6c66f39d2f11ab93fcfed21f593 (diff)
slab: fix calculate_slab_order() for SLAB_RECLAIM_ACCOUNT
Instead of having a hard-to-read and confusing conditional in the caller, just make the slab order calculation handle this special case, since it's simple and obvious there. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/slab.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/mm/slab.c b/mm/slab.c
index f2e92dc1c9c..6ad6bd5a0b3 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1648,6 +1648,14 @@ static inline size_t calculate_slab_order(struct kmem_cache *cachep,
left_over = remainder;
/*
+ * A VFS-reclaimable slab tends to have most allocations
+ * as GFP_NOFS and we really don't want to have to be allocating
+ * higher-order pages when we are unable to shrink dcache.
+ */
+ if (flags & SLAB_RECLAIM_ACCOUNT)
+ break;
+
+ /*
* Large number of objects is good, but very large slabs are
* currently bad for the gfp()s.
*/
@@ -1869,17 +1877,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
size = ALIGN(size, align);
- if ((flags & SLAB_RECLAIM_ACCOUNT) && size <= PAGE_SIZE) {
- /*
- * A VFS-reclaimable slab tends to have most allocations
- * as GFP_NOFS and we really don't want to have to be allocating
- * higher-order pages when we are unable to shrink dcache.
- */
- cachep->gfporder = 0;
- cache_estimate(cachep->gfporder, size, align, flags,
- &left_over, &cachep->num);
- } else
- left_over = calculate_slab_order(cachep, size, align, flags);
+ left_over = calculate_slab_order(cachep, size, align, flags);
if (!cachep->num) {
printk("kmem_cache_create: couldn't create cache %s.\n", name);