[Suspend2][ 02/10] [Suspend2] Initialise nosave zone table

From: Nigel Cunningham
Date: Tue Jun 27 2006 - 01:11:27 EST


Suspend2 uses swsusp code to restore lowmem pages, but (like swsusp) has a
separate routine for restoring highmem pages. This routine sets up a copy
of the start and end pfn numbers for use in restoring highmem pages. It is
invoked prior to the atomic restore beginning.

Signed-off-by: Nigel Cunningham <nigel@xxxxxxxxxxxx>

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

diff --git a/kernel/power/atomic_copy.c b/kernel/power/atomic_copy.c
index e54de43..07b418c 100644
--- a/kernel/power/atomic_copy.c
+++ b/kernel/power/atomic_copy.c
@@ -50,3 +50,28 @@ struct zone_data {
static __nosavedata struct zone_data *zone_nosave;
static __nosavedata int num_zones;

+/**
+ * suspend_init_nosave_zone_table: Set up nosave copy of zone table data.
+ *
+ * Zone information might be overwritten during the copy back, so we copy
+ * the fields we need to a non-conflicting page and use it.
+ **/
+static void suspend_init_nosave_zone_table(void)
+{
+ struct zone *zone;
+
+ zone_nosave = (struct zone_data *) suspend_get_nonconflicting_page();
+
+ BUG_ON(!zone_nosave);
+
+ for_each_zone(zone) {
+ if (zone->spanned_pages) {
+ zone_nosave[num_zones].start_pfn = zone->zone_start_pfn;
+ zone_nosave[num_zones].end_pfn = zone->zone_start_pfn +
+ zone->spanned_pages - 1;
+ zone_nosave[num_zones].is_highmem = is_highmem(zone);
+ }
+ num_zones++;
+ }
+}
+

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