linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-mm <linux-mm@kvack.org>, Pavel Machek <pavel@suse.cz>,
	Mike Kravetz <kravetz@us.ibm.com>
Subject: Re: [PATCH] [RFC] for_each_page_in_zone [1/1]
Date: Fri, 24 Feb 2006 07:43:45 -0800	[thread overview]
Message-ID: <1140795826.8697.86.camel@localhost.localdomain> (raw)
In-Reply-To: <20060224171518.29bae84b.kamezawa.hiroyu@jp.fujitsu.com>

On Fri, 2006-02-24 at 17:15 +0900, KAMEZAWA Hiroyuki wrote:
> +struct page *next_page_in_zone(struct page *page, struct zone *zone)
> +{
> +       unsigned long pfn = page_to_pfn(page);
> +
> +       if (!populated_zone(zone))
> +               return NULL;
> +
> +       pfn = next_valid_pfn(pfn, zone->zone_start_pfn + zone->spanned_pages);
> +
> +       if (pfn == END_PFN)
> +               return NULL;
> +
> +       return pfn_to_page(pfn);
> +} 

If there can be a case where a node spans other nodes, then I don't
think this patch will work.  The next_valid_pfn() could be a pfn in
another zone.  I believe that you may have to do a pfn_to_page() and
check the zone on each one.  

There are some ppc64 machines which have memory laid out like this:

  0-100 MB Node0
100-200 MB Node1
200-300 MB Node0

Node0's ZONE_DMA has a start_pfn of 0, a spanned_pages of 300MB and a
present_pages of 200MB.  The next_valid_pfn() after the first 100MB is a
page in Node1.

Sorry if I missed this on the first go around.  

-- Dave

--
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>

  parent reply	other threads:[~2006-02-24 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24  8:15 KAMEZAWA Hiroyuki
2006-02-24 10:52 ` Pavel Machek
2006-02-24 11:59   ` KAMEZAWA Hiroyuki
2006-02-24 15:43 ` Dave Hansen [this message]
2006-02-25  1:24   ` KAMEZAWA Hiroyuki
2006-02-25  1:31     ` KAMEZAWA Hiroyuki

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=1140795826.8697.86.camel@localhost.localdomain \
    --to=haveblue@us.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kravetz@us.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=pavel@suse.cz \
    /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