From 12a2b58c671af91518414b9176a3327167394bca Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 8 Feb 2018 09:37:17 +0000 Subject: [PATCH] Toss all releaseable memory, because fragmentation can get in the way of allocating the hibernate playpen. --- sys/dev/acpi/acpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 58b18398f7f..375505c7e1b 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.336 2018/02/08 06:02:09 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.337 2018/02/08 09:37:17 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -2485,8 +2485,12 @@ acpi_sleep_state(struct acpi_softc *sc, int sleepmode) #ifdef HIBERNATE if (sleepmode == ACPI_SLEEP_HIBERNATE) { - uvmpd_hibernate(); + /* + * Discard useless memory to reduce fragmentation, + * and attempt to create a hibernate work area + */ hibernate_suspend_bufcache(); + uvmpd_hibernate(); if (hibernate_alloc()) { printf("%s: failed to allocate hibernate memory\n", sc->sc_dev.dv_xname); -- 2.20.1