From fa50e249271b8283b9146f22849bd71eb56af793 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Sun, 16 Dec 2018 08:31:51 +0000 Subject: Make the freelist best fit code a tiny bit smarter to not use a block if half or more would be wasted. Causes more effective re-use of blocks. ok jsing@ --- sys/lib/libsa/alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/lib/libsa') diff --git a/sys/lib/libsa/alloc.c b/sys/lib/libsa/alloc.c index 5b51787733e..e84c1fc7745 100644 --- a/sys/lib/libsa/alloc.c +++ b/sys/lib/libsa/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.12 2016/03/14 23:08:06 krw Exp $ */ +/* $OpenBSD: alloc.c,v 1.13 2018/12/16 08:31:50 otto Exp $ */ /* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */ /* @@ -169,7 +169,7 @@ alloc(unsigned int size) } /* no match in freelist if bestsize unchanged */ - failed = (bestsize == 0xffffffff); + failed = (bestsize == 0xffffffff || bestsize >= size * 2); #endif if (failed) { /* nothing found */ -- cgit v1.2.3