[Suspend2][ 03/11] [Suspend2] Get memory needed for Suspend2 modules.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux