public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>, Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH 1/3] swsusp: Fix mark_free_pages
Date: Wed, 02 Aug 2006 12:51:18 -0700	[thread overview]
Message-ID: <1154548279.7232.34.camel@localhost.localdomain> (raw)
In-Reply-To: <200608021848.54374.rjw@sisk.pl>

On Wed, 2006-08-02 at 18:48 +0200, Rafael J. Wysocki wrote:
> +       max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
> +       for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) {
> +               struct page *page = pfn_to_page(pfn);
> +
> +               if (!PageNosave(page))
> +                       ClearPageNosaveFree(page);
> +       } 

This is certainly not the only place in swsusp where there is a bug like
this, but it is not correct to assume that each page inside of a zone is
valid.  With sparsemem, you need to do pfn_valid() on each pfn before
calling pfn_to_page().

Something like:

       max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
       for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) {
		struct page *page;
		if (!pfn_valid(pfn))
			continue;

		page = pfn_to_page(pfn);
		if (!PageNosave(page))
                       ClearPageNosaveFree(page);
       } 


-- Dave


  reply	other threads:[~2006-08-02 19:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-02 16:42 [PATCH 0/3] swsusp cleanups Rafael J. Wysocki
2006-08-02 16:48 ` [PATCH 1/3] swsusp: Fix mark_free_pages Rafael J. Wysocki
2006-08-02 19:51   ` Dave Hansen [this message]
2006-08-02 20:12     ` Rafael J. Wysocki
2006-08-02 20:30       ` Pavel Machek
2006-08-02 20:48         ` Rafael J. Wysocki
2006-08-02 16:53 ` [PATCH 2/3] swsusp: Reorder memory-allocating functions Rafael J. Wysocki
2006-08-02 20:19   ` Pavel Machek
2006-08-02 16:57 ` [PATCH 3/3] swsusp: Fix alloc_pagedir Rafael J. Wysocki
2006-08-02 20:22   ` Pavel Machek

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=1154548279.7232.34.camel@localhost.localdomain \
    --to=haveblue@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    /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