Re: swsusp with highmem, testing wanted

Pavel Machek
2004-03-25T21:59:39Z

Hi!

> I think this kind of thing should help stabilize swsusp in the presence
> of memory holes, which can be important for embedded devices which would
> in the future find swsusp useful for power-saving purposes.

I had to apply this to compile it, I have not ran it yet.

Pavel

--- tmp/linux/kernel/power/swsusp.c 2004-03-25 14:42:07.000000000 +0100
+++ linux/kernel/power/swsusp.c 2004-03-25 14:41:12.000000000 +0100
@@ -443,16 +443,16 @@

static int pfn_is_nosave(unsigned long pfn)
{
- static const unsigned long nosave_begin_pfn
+ unsigned long nosave_begin_pfn
= __pa(&__nosave_begin) >> PAGE_SHIFT;
- static const unsigned long nosave_end_pfn
+ unsigned long nosave_end_pfn
= PAGE_ALIGN(__pa(&__nosave_end)) >> PAGE_SHIFT;
return pfn >= nosave_begin_pfn && pfn < nosave_end_pfn;
}

static int count_and_copy_zone(struct zone *zone, struct pbe **pagedir_p)
{
- unsigned long zone_pfn, nr_copy_pages = 0;
+ unsigned long zone_pfn, chunk_size, nr_copy_pages = 0;
struct pbe *pbe = *pagedir_p;
for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) {
struct page *page;
@@ -472,7 +472,7 @@
}
nr_copy_pages++;
if (!pbe)
- continue
+ continue;
pbe->orig_address = page_address(page);
copy_page((void *)pbe->address, (void *)pbe->orig_address);
pbe++;
@@ -495,7 +495,7 @@
static void free_suspend_pagedir_zone(struct zone *zone, unsigned long pagedir)
{
unsigned long zone_pfn, pagedir_end, pagedir_pfn, pagedir_end_pfn;
- pagedir_end = pagedir + PAGE_SIZE << pagedir_order;
+ pagedir_end = pagedir + (PAGE_SIZE << pagedir_order);
pagedir_pfn = __pa(pagedir) >> PAGE_SHIFT;
pagedir_end_pfn = __pa(pagedir_end) >> PAGE_SHIFT;
for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) {
@@ -517,7 +517,7 @@
struct zone *zone;
for_each_zone(zone) {
if (!is_highmem(zone))
- free_suspend_pagedir_zone(this_pagedir);
+ free_suspend_pagedir_zone(zone, this_pagedir);
}
free_pages(this_pagedir, pagedir_order);
}

--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]