Re: [swsusp] Rework image freeing

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

 



On Wed, 2005-09-21 at 22:51 +0200, Pavel Machek wrote:
> +void swsusp_free(void)
...
> +       for_each_zone(zone) {
> +               for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) {
> +                       struct page * page;
> +                       page = pfn_to_page(zone_pfn + zone->zone_start_pfn);
> +                       if (PageNosave(page) && PageNosaveFree(page)) {
> +                               ClearPageNosave(page);
> +                               ClearPageNosaveFree(page);
> +                               free_page((long) page_address(page));
> +                       }
>                 }
>         }

This won't work with discontiguous page ranges.  Due to sparsemem you
can run into pages in the middle of a zone where pfn_to_page() doesn't
work.  I'd suggest adding a pfn_valid() check in there.  

-- 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]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux