lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 17/20] [Suspend2] Calculate the amount of free memory needed.
Date
Calculate the minimum amount of free ram before we will consider ourselves
to have enough to cover all expected needs. We can have the VM freeing
memory for us - that would create an inconsistent image.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

kernel/power/prepare_image.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/kernel/power/prepare_image.c b/kernel/power/prepare_image.c
index 604089f..054d0d4 100644
--- a/kernel/power/prepare_image.c
+++ b/kernel/power/prepare_image.c
@@ -520,3 +520,11 @@ long storage_needed(int use_ecr, int ign
+ header_storage_needed());
}

+long ram_to_suspend(void)
+{
+ return (1 +
+ max_t(long, (pagedir1.pageset_size + extra_pd1_pages_allowance -
+ pageset2_sizelow - extra_pagedir_pages_allocated) / 2, 0) +
+ MIN_FREE_RAM + suspend_memory_for_modules());
+}
+
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-27 01:26    [W:0.105 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site