From: Nick Piggin <nickpiggin@yahoo.com.au>
To: ncunningham@cyclades.com
Cc: Linux Memory Management <linux-mm@kvack.org>,
Pavel Machek <pavel@suse.cz>, Hugh Dickins <hugh@veritas.com>,
William Lee Irwin III <wli@holomorphy.com>
Subject: Re: PageReserved removal from swsusp
Date: Mon, 25 Jul 2005 16:22:37 +1000 [thread overview]
Message-ID: <42E4852D.7010209@yahoo.com.au> (raw)
In-Reply-To: <42E46FF5.5080805@yahoo.com.au>
[-- Attachment #1: Type: text/plain, Size: 598 bytes --]
Nick Piggin wrote:
> I'm currently playing around with trying to reuse an existing flag
> to get this information (instead of PageReserved). But it doesn't seem
> like a big problem if we have to fall back to the above.
>
OK, with the attached patch (on top of the PageReserved removal patches)
things work nicely. However I'm not sure that I really like the use of
flags == 0xffffffff to indicate the page is unusable. For one thing it
may confuse things that walk physical pages, and for another it can
easily break if someone clears a flag of an 'unusable' page.
--
SUSE Labs, Novell Inc.
[-- Attachment #2: mm-PageUnusable.patch --]
[-- Type: text/plain, Size: 3482 bytes --]
Index: linux-2.6/arch/i386/mm/init.c
===================================================================
--- linux-2.6.orig/arch/i386/mm/init.c
+++ linux-2.6/arch/i386/mm/init.c
@@ -273,7 +273,7 @@ void __init one_highpage_init(struct pag
__free_page(page);
totalhigh_pages++;
} else
- SetPageReserved(page);
+ SetPageUnusable(page);
}
#ifdef CONFIG_NUMA
@@ -573,7 +573,7 @@ void __init mem_init(void)
/*
* Only count reserved RAM pages
*/
- if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
+ if (!PageUnusable(pfn_to_page(tmp)) && PageReserved(pfn_to_page(tmp)))
reservedpages++;
set_highmem_pages_init(bad_ppro);
Index: linux-2.6/include/linux/page-flags.h
===================================================================
--- linux-2.6.orig/include/linux/page-flags.h
+++ linux-2.6/include/linux/page-flags.h
@@ -306,6 +306,9 @@ extern void __mod_page_state(unsigned lo
#define SetPageUncached(page) set_bit(PG_uncached, &(page)->flags)
#define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags)
+#define PageUnusable(page) ((page)->flags == 0xffffffff)
+#define SetPageUnusable(page) ((page)->flags = 0xffffffff)
+
struct page; /* forward declaration */
int test_clear_page_dirty(struct page *page);
Index: linux-2.6/kernel/power/swsusp.c
===================================================================
--- linux-2.6.orig/kernel/power/swsusp.c
+++ linux-2.6/kernel/power/swsusp.c
@@ -433,16 +433,8 @@ static int save_highmem_zone(struct zone
if (!pfn_valid(pfn))
continue;
page = pfn_to_page(pfn);
- /*
- * This condition results from rvmalloc() sans vmalloc_32()
- * and architectural memory reservations. This should be
- * corrected eventually when the cases giving rise to this
- * are better understood.
- */
- if (PageReserved(page)) {
- printk("highmem reserved page?!\n");
+ if (PageUnusable(page))
continue;
- }
BUG_ON(PageNosave(page));
if (PageNosaveFree(page))
continue;
@@ -528,6 +520,8 @@ static int saveable(struct zone * zone,
return 0;
page = pfn_to_page(pfn);
+ if (PageUnusable(page))
+ return 0;
if (PageNosave(page))
return 0;
if (pfn_is_nosave(pfn)) {
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -576,22 +576,29 @@ void mark_free_pages(struct zone *zone)
unsigned long zone_pfn, flags;
int order;
struct list_head *curr;
+ struct page *page;
if (!zone->spanned_pages)
return;
spin_lock_irqsave(&zone->lock, flags);
- for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn)
- ClearPageNosaveFree(pfn_to_page(zone_pfn + zone->zone_start_pfn));
+ for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) {
+ page = pfn_to_page(zone_pfn + zone->zone_start_pfn);
+ if (PageUnusable(page))
+ continue;
+ ClearPageNosaveFree(page);
+ }
for (order = MAX_ORDER - 1; order >= 0; --order)
list_for_each(curr, &zone->free_area[order].free_list) {
- unsigned long start_pfn, i;
+ unsigned long i;
- start_pfn = page_to_pfn(list_entry(curr, struct page, lru));
-
- for (i=0; i < (1<<order); i++)
- SetPageNosaveFree(pfn_to_page(start_pfn+i));
+ page = list_entry(curr, struct page, lru);
+ for (i=0; i < (1<<order); i++) {
+ if (PageUnusable(page+i))
+ continue;
+ SetPageNosaveFree(page+i);
+ }
}
spin_unlock_irqrestore(&zone->lock, flags);
}
next prev parent reply other threads:[~2005-07-25 6:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-25 1:38 Nick Piggin
2005-07-25 4:31 ` Nigel Cunningham
2005-07-25 4:52 ` Nick Piggin
2005-07-25 6:22 ` Nick Piggin [this message]
2005-07-25 6:59 ` Pavel Machek
2005-07-25 12:39 ` Hugh Dickins
2005-07-25 23:29 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42E4852D.7010209@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=ncunningham@cyclades.com \
--cc=pavel@suse.cz \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox