Re: [PATCH 1/3] swsusp: Fix mark_free_pages
From: Dave Hansen
Date: Wed Aug 02 2006 - 15:49:24 EST
On Wed, 2006-08-02 at 18:48 +0200, Rafael J. Wysocki wrote:
> + max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
> + for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) {
> + struct page *page = pfn_to_page(pfn);
> +
> + if (!PageNosave(page))
> + ClearPageNosaveFree(page);
> + }
This is certainly not the only place in swsusp where there is a bug like
this, but it is not correct to assume that each page inside of a zone is
valid. With sparsemem, you need to do pfn_valid() on each pfn before
calling pfn_to_page().
Something like:
max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) {
struct page *page;
if (!pfn_valid(pfn))
continue;
page = pfn_to_page(pfn);
if (!PageNosave(page))
ClearPageNosaveFree(page);
}
-- Dave
-
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/