mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 06:28:00 +02:00
When calculating used swap space, only use anonymous pages
up_daemon_check_swap_space uses the Active: line from /proc/meminfo to determine the amount of swap the system needs to be able to suspend. However, because Active: includes both anonymous and file-backed pages, this greatly overestimates the amount of swap needed. File-backed pages can be written back to disk and so do not consume swap. Instead, up_daemon_check_swap_space should use Active(anon): from /proc/meminfo because only anonymous pages need to be written out to swap during a suspend. Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
parent
37504601f3
commit
6bb6602c06
1 changed files with 1 additions and 1 deletions
|
|
@ -511,7 +511,7 @@ up_backend_get_used_swap (UpBackend *backend)
|
|||
swap_free = atoi (tokens[len-2]);
|
||||
if (g_strcmp0 (tokens[0], "SwapTotal") == 0)
|
||||
swap_total = atoi (tokens[len-2]);
|
||||
else if (g_strcmp0 (tokens[0], "Active") == 0)
|
||||
else if (g_strcmp0 (tokens[0], "Active(anon)") == 0)
|
||||
active = atoi (tokens[len-2]);
|
||||
}
|
||||
g_strfreev (tokens);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue