lkml.org 
[lkml]   [2005]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [RFC][patch 0/2] mm: remove PageReserved
Date
Hi,

On Wednesday, 10 of August 2005 23:50, Pavel Machek wrote:
> Hi!
>
> > > 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 <rjw@sisk.pl>

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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-11 12:23    [from the cache]
©2003-2011 Jasper Spaans