Re: [RFC][patch 0/2] mm: remove PageReserved
From: Rafael J. Wysocki <hidden>
Date: 2005-08-11 10:20:45
Also in:
lkml
Hi, On Wednesday, 10 of August 2005 23:50, Pavel Machek wrote:
Hi!quoted
quoted
Swsusp is the main "is valid ram" user I have in mind here. It wants to know whether or not it should save and restore the memory of a given `struct page`.Why can't it follow the rmap chain?It is walking physical memory, not memory managment chains. I need something like: 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)) {
This only is a trick to avoid calling pfn_is_nosave(pfn) for every single page that is neither PageNosave nor PageNosaveFree, isn't it?
pr_debug("[nosave pfn 0x%lx]", pfn);
return 0;
}
if (PageNosaveFree(page))
return 0;
return 1;
}IMO it is safe to drop PageReserved from this function completely, which is done in the following (experimental) patch (tested on x86-64). Greets, Rafael Signed-off-by: Rafael J. Wysocki <redacted> Index: linux-2.6.13-rc5-mm1/kernel/power/swsusp.c ===================================================================
--- linux-2.6.13-rc5-mm1.orig/kernel/power/swsusp.c
+++ linux-2.6.13-rc5-mm1/kernel/power/swsusp.c@@ -674,15 +674,14 @@ static int saveable(struct zone * zone, 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; + if (pfn_is_nosave(pfn)) { + pr_debug(" [nosave pfn 0x%lx]\n", pfn); + return 0; + } return 1; }
--
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
-- Lewis Carroll "Alice's Adventures in Wonderland"
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>