summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-07-07 15:01:27 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2010-07-07 15:08:43 +0200
commitc4a1c15d0ccba73b987b280370f913f47a5cbf09 (patch)
tree713f522e3df584c1e2076788a4a034f336d798e5
parent04eefe984c86df041b55be14236ae413711d1c7d (diff)
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.
-rw-r--r--src/linux/up-backend.c3
-rw-r--r--src/up-daemon.c6
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 */