From c0fa4d575922c9f1cafccbb4a41ae40d471a0509 Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 8 Feb 2018 09:42:48 +0000 Subject: [PATCH] After flushing disks, try again to release all memory. We don't need to save dirty memory to the hibernate space. --- sys/dev/acpi/acpi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 375505c7e1b..ea23d66040a 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.337 2018/02/08 09:37:17 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.338 2018/02/08 09:42:48 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -2512,6 +2512,18 @@ acpi_sleep_state(struct acpi_softc *sc, int sleepmode) acpi_sleep_mp(); #endif +#ifdef HIBERNATE + if (sleepmode == ACPI_SLEEP_HIBERNATE) { + /* + * We've just done various forms of syncing to disk + * churned lots of memory dirty. We don't need to + * save that dirty memory to hibernate, so release it. + */ + hibernate_suspend_bufcache(); + uvmpd_hibernate(); + } +#endif /* HIBERNATE */ + resettodr(); s = splhigh(); -- 2.20.1