lkml.org 
[lkml]   [2004]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectSuspend 2 merge: 28/51: Suspend memory pool hooks.
From
Date
We save the image in two pages (LRU and the rest). In order to maintain
a consistent image, we satisfy all page allocations from our own memory
pool while saving the image and reloading the LRU. This allows us to
safely use high level routines which might allocate slab etc and not
free it again by the time we do our atomic copy. We simply save all of
the pages in the pool when making our atomic copy of the non-LRU pages,
without having to worry about exactly how they were or weren't used.

diff -ruN 815-add-suspend-memory-pool-hooks-old/mm/page_alloc.c 815-add-suspend-memory-pool-hooks-new/mm/page_alloc.c
--- 815-add-suspend-memory-pool-hooks-old/mm/page_alloc.c 2004-11-06 09:26:49.168250960 +1100
+++ 815-add-suspend-memory-pool-hooks-new/mm/page_alloc.c 2004-11-04 16:27:41.000000000 +1100
@@ -277,6 +277,11 @@

arch_free_page(page, order);

+ if (unlikely(test_suspend_state(SUSPEND_USE_MEMORY_POOL))) {
+ suspend2_free_pool_pages(page, order);
+ return;
+ }
+
mod_page_state(pgfree, 1 << order);
for (i = 0 ; i < (1 << order) ; ++i)
free_pages_check(__FUNCTION__, page + i);
@@ -507,6 +512,11 @@

arch_free_page(page, 0);

+ if (unlikely(test_suspend_state(SUSPEND_USE_MEMORY_POOL))) {
+ suspend2_free_pool_pages(page, 0);
+ return;
+ }
+
kernel_map_pages(page, 1, 0);
inc_page_state(pgfree);
if (PageAnon(page))
@@ -609,6 +619,20 @@
int do_retry;
int can_try_harder;

+ if (unlikely(test_suspend_state(SUSPEND_USE_MEMORY_POOL))) {
+ /*
+ * When pool enabled, processes get allocations
+ * from a special pool so the image size doesn't
+ * vary (all the pages in the pool are saved,
+ * used or not).
+ *
+ * The only process that should be running is
+ * suspend, so the demand should be very
+ * predicatable.
+ */
+ return suspend2_get_pool_pages(gfp_mask, order);
+ }
+
might_sleep_if(wait);

/*

-
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: 2005-03-22 14:08    [W:0.392 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site