Commit 69e74939 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] slab: reduce internal fragmentation

From Manfred Spraul

If an object is freed from a slab, then move the slab to the tail of
the partial list - this should increase the probability that the other
objects from the same page are freed, too, and that a page can be
returned to gfp later.

In other words: if we just freed an object from this page then make
this page be the *last* page which is eligible for new allocations.
Under the assumption that other objects in that same page are about to
be freed up as well.

The cpu arrays are now always in front of the list, i.e.  cache hit
rates should not matter.
parent 23797198
...@@ -1478,7 +1478,7 @@ static inline void cache_free_one(kmem_cache_t *cachep, void *objp) ...@@ -1478,7 +1478,7 @@ static inline void cache_free_one(kmem_cache_t *cachep, void *objp)
} else if (unlikely(inuse == cachep->num)) { } else if (unlikely(inuse == cachep->num)) {
/* Was full. */ /* Was full. */
list_del(&slabp->list); list_del(&slabp->list);
list_add(&slabp->list, &cachep->slabs_partial); list_add_tail(&slabp->list, &cachep->slabs_partial);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment