summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2024-11-05 14:49:53 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2024-11-05 14:49:53 +0000
commit01c656cefcd452a2357403c751654fcf7f4c1181 (patch)
tree8586fe80e9bc6355e6b10341e3a45f7075840269 /sys/arch/macppc
parent04d9a5d044fb10db615692bd66749542d96f5af3 (diff)
Apply the changes in sys/lib/libsa/alloc.c 1.13 to the other copies of that
file modified to use OpenFirmware routines: ``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.'' Bump bootloader version in the unlikely case this misbehaves on some machines.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/stand/alloc.c8
-rw-r--r--sys/arch/macppc/stand/conf.c4
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/arch/macppc/stand/alloc.c b/sys/arch/macppc/stand/alloc.c
index 62afba2976a..787c7607fb1 100644
--- a/sys/arch/macppc/stand/alloc.c
+++ b/sys/arch/macppc/stand/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.11 2019/09/02 23:40:29 kettenis Exp $ */
+/* $OpenBSD: alloc.c,v 1.12 2024/11/05 14:49:52 miod Exp $ */
/* $NetBSD: alloc.c,v 1.1 1997/04/16 20:29:16 thorpej Exp $ */
/*
@@ -95,7 +95,9 @@ void *
alloc(unsigned size)
{
struct ml *f, *bestf = NULL;
+#ifndef ALLOC_FIRST_FIT
unsigned bestsize = 0xffffffff; /* greater than any real size */
+#endif
char *help;
int failed;
@@ -132,7 +134,7 @@ alloc(unsigned size)
}
/* no match in freelist if bestsize unchanged */
- failed = (bestsize == 0xffffffff);
+ failed = (bestsize == 0xffffffff || bestsize >= size * 2);
#endif
if (failed) { /* nothing found */
@@ -157,7 +159,9 @@ alloc(unsigned size)
/* we take the best fit */
f = bestf;
+#ifndef ALLOC_FIRST_FIT
found:
+#endif
/* remove from freelist */
LIST_REMOVE(f, list);
help = (char *)f;
diff --git a/sys/arch/macppc/stand/conf.c b/sys/arch/macppc/stand/conf.c
index c5770867a8f..aca3b5e23cf 100644
--- a/sys/arch/macppc/stand/conf.c
+++ b/sys/arch/macppc/stand/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.15 2024/11/01 17:16:04 gkoehler Exp $ */
+/* $OpenBSD: conf.c,v 1.16 2024/11/05 14:49:52 miod Exp $ */
/*
* Copyright (c) 2007 Dale Rahn <drahn@openbsd.org>
*
@@ -21,7 +21,7 @@
#include <lib/libsa/stand.h>
-const char version[] = "1.12";
+const char version[] = "1.13";
extern int debug;
void ofc_probe(struct consdev *);