Re: [PATCH 1/3] swsusp: Fix mark_free_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux