All of lore.kernel.org
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: linux-mm@kvack.org
Subject: Re: [RFC] memory-layout-free zones (for review) [1/3]	for_each_page_in_zone()
Date: Fri, 24 Feb 2006 08:45:25 +0900	[thread overview]
Message-ID: <43FE4915.50100@jp.fujitsu.com> (raw)
In-Reply-To: <1140717824.8697.59.camel@localhost.localdomain>

Dave Hansen wrote:
> On Thu, 2006-02-23 at 17:56 +0900, KAMEZAWA Hiroyuki wrote:
>> +/*
>> + *  These inline function for for_each_page_in_zone can work
>> + *  even if CONFIG_SPARSEMEM=y.
>> + */
>> +static inline struct page *first_page_in_zone(struct zone *zone)
>> +{
>> +	unsigned long start_pfn = zone->zone_start_pfn;
>> +	unsigned long i = 0;
>> +
>> +	if (!populated_zone(zone))
>> +		return NULL;
>> +
>> +	for (i = 0; i < zone->zone_spanned_pages; i++) {
>> +		if (pfn_valid(start_pfn + i))
>> +			break;
>> +	}
>> +	return pfn_to_page(start_pfn + i);
>> +}
> 
> Isn't this a little hefty of a function for an inline?
> 
Hmm...making this out-of-line and adding this to page_alloc.c or
mmzone.c(new) looks better. (Then, we can write the best function for
each memory-model.)


> Also, why would we _ever_ have a zone that didn't actually have a valid
> pfn at its start?  If there wasn't a valid pfn there, with no
> zone_mem_map, wouldn't we just bump up the start_pfn?
> 
This patch is just for cleanup for avoiding complicated big patch.

>> +static inline struct page *next_page_in_zone(struct page *page,
>> +					     struct zone *zone)
>> +{
>> +	unsigned long start_pfn = zone->zone_start_pfn;
>> +	unsigned long i = page_to_pfn(page) - start_pfn;
>> +
>> +	if (!populated_zone(zone))
>> +		return NULL;
>> +
>> +	for (i = i + 1; i < zone->zone_spanned_pages; i++) {
>> +		if (pfn_vlaid(start_pfn + i))
>> +			break;
>> +	}
>> +	if (i == zone->zone_spanned_pages)
>> +		return NULL;
>> +	return pfn_to_page(start_pfn + i);
>> +}
> 
> Seems like this should share code with the other function.  And the
> "vlaid" part looks a bit uncompilable. ;)
> 
yes....uncompilable....

Thanks,
-- Kame

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

      reply	other threads:[~2006-02-23 23:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-23  8:56 [RFC] memory-layout-free zones (for review) [1/3] for_each_page_in_zone() KAMEZAWA Hiroyuki
2006-02-23 18:03 ` Dave Hansen
2006-02-23 23:45   ` KAMEZAWA Hiroyuki [this message]

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=43FE4915.50100@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=haveblue@us.ibm.com \
    --cc=linux-mm@kvack.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.