From c4a1c15d0ccba73b987b280370f913f47a5cbf09 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Jul 2010 15:01:27 +0200 Subject: [PATCH] Fix UP_DAEMON_WATERLINE harder Commmit fc7c6e003 had a thinko, UP_DAEMON_WATERLINE specifies (active memory)/(available swap), not the other way around. So replace it with 99% instead. Also update the documentation of up_backend_get_used_swap() to explain what the returned percentage actually means. --- src/linux/up-backend.c | 3 ++- src/up-daemon.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c index aa6f33b..021b36f 100644 --- a/src/linux/up-backend.c +++ b/src/linux/up-backend.c @@ -480,7 +480,8 @@ out: /** * up_backend_get_used_swap: * - * Return value: a percentage value + * Return value: a percentage value how much of the available swap memory would + * be taken by currently active memory **/ gfloat up_backend_get_used_swap (UpBackend *backend) diff --git a/src/up-daemon.c b/src/up-daemon.c index c6cf755..d2f9677 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -105,9 +105,9 @@ G_DEFINE_TYPE (UpDaemon, up_daemon, G_TYPE_OBJECT) /* if using more memory compared to usable swap, disable hibernate */ /* 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 /* % */ + * page meta information for each MB of active memory. Add some error margin + * here, though. */ +#define UP_DAEMON_SWAP_WATERLINE 98f /* % */ /* refresh all the devices after this much time when on-battery has changed */ #define UP_DAEMON_ON_BATTERY_REFRESH_DEVICES_DELAY 1 /* seconds */