]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] slab: reduce internal fragmentation
authorAndrew Morton <akpm@digeo.com>
Wed, 30 Oct 2002 07:24:12 +0000 (23:24 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 30 Oct 2002 07:24:12 +0000 (23:24 -0800)
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.

mm/slab.c

index fc11fb4af551dec4930abd0859d2918450abe935..3cfa6db156b44cd0ef075c567205f221a147d3c3 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1478,7 +1478,7 @@ static inline void cache_free_one(kmem_cache_t *cachep, void *objp)
                } else if (unlikely(inuse == cachep->num)) {
                        /* Was full. */
                        list_del(&slabp->list);
-                       list_add(&slabp->list, &cachep->slabs_partial);
+                       list_add_tail(&slabp->list, &cachep->slabs_partial);
                }
        }
 }