Messages in this thread Patch in this message | | | From | Nigel Cunningham <> | Subject | [Suspend2][ 07/10] [Suspend2] Post suspend context-save routine | Date | Tue, 27 Jun 2006 14:39:10 +1000 |
| |
At suspend-time, after saving the cpu context using the swsusp code, this routine is invoked to save the atomic copy, enter the chosen state (possibly suspend to ram), and cleanup if we come back from that state.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
kernel/power/atomic_copy.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/kernel/power/atomic_copy.c b/kernel/power/atomic_copy.c index a834623..cb3663c 100644 --- a/kernel/power/atomic_copy.c +++ b/kernel/power/atomic_copy.c @@ -262,3 +262,43 @@ void copyback_post(void) suspend_prepare_status(DONT_CLEAR_BAR, "Cleaning up..."); } +/* + * suspend_post_context_save: Steps after saving the cpu context. + * + * Steps taken after saving the CPU state to make the actual + * atomic copy. + * + * Called from swsusp_save in snapshot.c. + */ + +int suspend_post_context_save(void) +{ + int old_ps1_size = pagedir1.pageset_size; + int old_ps2_size = pagedir2.pageset_size; + + BUG_ON(!irqs_disabled()); + + suspend_recalculate_image_contents(1); + + extra_pd1_pages_used = pagedir1.pageset_size - old_ps1_size; + + if ((pagedir1.pageset_size - old_ps1_size) > extra_pd1_pages_allowance) { + abort_suspend("Pageset1 has grown by %d pages." + " Only %d growth is allowed for!\n", + pagedir1.pageset_size - old_ps1_size, + extra_pd1_pages_allowance); + return -1; + } + + BUG_ON(old_ps2_size != pagedir2.pageset_size); + + BUG_ON(!irqs_disabled()); + + if (!test_action_state(SUSPEND_TEST_FILTER_SPEED) && + !test_action_state(SUSPEND_TEST_BIO)) + suspend_copy_pageset1(); + + + return 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 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/
| |