diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-01 13:50:20 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-01 14:04:51 +0100 |
commit | 851d51c14cf11e77db8b0e4acd1360b3c6de793a (patch) | |
tree | d70681b18d44b28ac6f14b4b9410ed5abef924d7 /mach-defpager | |
parent | 6a87666e5dc079b935ff1b2e73168c205885ab66 (diff) | |
download | hurd-851d51c14cf11e77db8b0e4acd1360b3c6de793a.tar.gz hurd-851d51c14cf11e77db8b0e4acd1360b3c6de793a.tar.bz2 hurd-851d51c14cf11e77db8b0e4acd1360b3c6de793a.zip |
mach-defpager: Fix computing free space
Diffstat (limited to 'mach-defpager')
-rw-r--r-- | mach-defpager/default_pager.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index 5c1352f4..78bcb279 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -3790,28 +3790,30 @@ void overcommitted(got_more_space, space) static boolean_t user_warned = FALSE; static vm_size_t pages_shortage = 0; + ssize_t total_free; paging_space_info(&pages_total, &pages_free); /* * If user added more space, see if it is enough */ + total_free = pages_free; if (got_more_space) { - pages_free -= pages_shortage; - if (pages_free > 0) { + total_free -= pages_shortage; + if (total_free > 0) { pages_shortage = 0; if (user_warned) dprintf("%s paging space ok now.\n", my_name); } else - pages_shortage = pages_free; + pages_shortage = total_free; user_warned = FALSE; return; } /* * We ran out of gas, let user know. */ - pages_free -= space; - pages_shortage = (pages_free > 0) ? 0 : -pages_free; + total_free -= space; + pages_shortage = (total_free > 0) ? 0 : -total_free; if (!user_warned && pages_shortage) { user_warned = TRUE; dprintf("%s paging space over-committed.\n", my_name); |