After flushing disks, try again to release all memory. We don't need to
authorderaadt <deraadt@openbsd.org>
Thu, 8 Feb 2018 09:42:48 +0000 (09:42 +0000)
committerderaadt <deraadt@openbsd.org>
Thu, 8 Feb 2018 09:42:48 +0000 (09:42 +0000)
save dirty memory to the hibernate space.

sys/dev/acpi/acpi.c

index 375505c..ea23d66 100644 (file)
@@ -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 <tholo@sigmasoft.com>
  * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -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();