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][ 03/11] [Suspend2] Get memory needed for Suspend2 modules.
Date
Determine how much free memory should be available for Suspend2 modules to
do their work while reading and writing the image.

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

kernel/power/modules.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/kernel/power/modules.c b/kernel/power/modules.c
index 60c7c7b..ff9b9d7 100644
--- a/kernel/power/modules.c
+++ b/kernel/power/modules.c
@@ -49,3 +49,25 @@ unsigned long suspend_header_storage_for
return bytes + sizeof(struct suspend_module_header);
}

+/*
+ * suspend_memory_for_modules
+ *
+ * Returns the amount of memory requested by modules for
+ * doing their work during the cycle.
+ */
+
+unsigned long suspend_memory_for_modules(void)
+{
+ unsigned long bytes = 0;
+ struct suspend_module_ops *this_module;
+
+ list_for_each_entry(this_module, &suspend_modules, module_list) {
+ if (this_module->disabled)
+ continue;
+ if (this_module->memory_needed)
+ bytes += this_module->memory_needed();
+ }
+
+ return ((bytes + PAGE_SIZE - 1) >> PAGE_SHIFT);
+}
+
--
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-26 19:04    [from the cache]
©2003-2011 Jasper Spaans