diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2018-12-16 08:31:51 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2018-12-16 08:31:51 +0000 |
commit | fa50e249271b8283b9146f22849bd71eb56af793 (patch) | |
tree | 1f965ddd43a4aa91cbd86fc3fb9711d41d04ea5a /sys/lib/libsa | |
parent | ec5cdc77201d412afe5bad1d396ea280476b55e7 (diff) |
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@
Diffstat (limited to 'sys/lib/libsa')
-rw-r--r-- | sys/lib/libsa/alloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 */ |