summaryrefslogtreecommitdiff
path: root/kern/slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/slab.c')
-rw-r--r--kern/slab.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kern/slab.c b/kern/slab.c
index 0a4dbdf..d14d07a 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -955,9 +955,12 @@ static void * kmem_cache_alloc_from_slab(struct kmem_cache *cache)
if (slab->nr_refs == 1)
cache->nr_free_slabs--;
} else if (slab->nr_refs == 1) {
- /* The slab has become partial */
+ /*
+ * The slab has become partial. Insert the new slab at the end of
+ * the list to reduce fragmentation.
+ */
list_remove(&slab->list_node);
- list_insert_head(&cache->partial_slabs, &slab->list_node);
+ list_insert_tail(&cache->partial_slabs, &slab->list_node);
cache->nr_free_slabs--;
}