[Suspend2][ 2/9] [Suspend2] Free extra memory allocated for the atomic copy.

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

 



If the page cache is not large enough to store the atomic copy, we allocate
extra pages. This routine is used at cleanup to free that memory.

Signed-off-by: Nigel Cunningham <[email protected]>

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

diff --git a/kernel/power/pagedir.c b/kernel/power/pagedir.c
index 1e0995e..9c26990 100644
--- a/kernel/power/pagedir.c
+++ b/kernel/power/pagedir.c
@@ -31,3 +31,26 @@ struct extras {
 	struct extras *next;
 } *extras_list;
 
+/* suspend_free_extra_pagedir_memory
+ *
+ * Description:	Free previously allocated extra pagedir memory.
+ */
+void suspend_free_extra_pagedir_memory(void)
+{
+	/* Free allocated pages */
+	while (extras_list) {
+		struct extras *this = extras_list;
+		int i;
+
+		extras_list = this->next;
+
+		for (i = 0; i < (1 << this->order); i++)
+			ClearPageNosave(this->page + i);
+
+		__free_pages(this->page, this->order);
+		kfree(this);
+	}
+
+	extra_pagedir_pages_allocated = 0;
+}
+

--
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