static struct page *saveable_page(unsigned long pfn) { struct page *page; if (!pfn_valid(pfn)) return NULL; page = pfn_to_page(pfn); if (PageNosave(page)) return NULL; if (PageReserved(page) && pfn_is_nosave(pfn)) return NULL; if (PageNosaveFree(page)) return NULL; return page; }
static int saveable(struct zone *zone, unsigned long *zone_pfn) { unsigned long pfn = *zone_pfn + zone->zone_start_pfn; struct page *page; if (!pfn_valid(pfn)) return 0; page = pfn_to_page(pfn); BUG_ON(PageReserved(page) && PageNosave(page)); if (PageNosave(page)) return 0; if (PageReserved(page) && pfn_is_nosave(pfn)) { pr_debug("[nosave pfn 0x%lx]", pfn); return 0; } if (PageNosaveFree(page)) return 0; return 1; }