From fc7c6e003a626367558300ce8566e346758ad8e7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Jul 2010 11:14:32 +0200 Subject: [PATCH] Increase UP_DAEMON_SWAP_WATERLINE Native Linux suspend-to-disk does not use compression, and needs 2 KB of page meta information for each MB of active memory. So bump the previous waterline of 80% of active memory to 100.2%. Add an extra .05% to prevent rounding errors. This should make the prediction whether hibernate is going to work very accurate. However, it might prevent hibernate for folks who use an alternative userspace solution like uswsusp which do support compression. http://lists.freedesktop.org/archives/devkit-devel/2010-July/000867.html --- src/up-daemon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/up-daemon.c b/src/up-daemon.c index f411146..c6cf755 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -104,7 +104,10 @@ G_DEFINE_TYPE (UpDaemon, up_daemon, G_TYPE_OBJECT) #define UP_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DAEMON, UpDaemonPrivate)) /* if using more memory compared to usable swap, disable hibernate */ -#define UP_DAEMON_SWAP_WATERLINE 80.0f /* % */ +/* Native Linux suspend-to-disk does not use compression, and needs 2 KB of + * page meta information for each MB of active memory. Add an extra .05% to + * prevent rounding errors. */ +#define UP_DAEMON_SWAP_WATERLINE 100.25f /* % */ /* refresh all the devices after this much time when on-battery has changed */ #define UP_DAEMON_ON_BATTERY_REFRESH_DEVICES_DELAY 1 /* seconds */