mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Andy Whitcroft <apw@shadowen.org>
Cc: linux-kernel@vger.kernel.org, apw@shadowen.org
Subject: Re: [PATCH] convert uses of ZONE_HIGHMEM to is_highmem
Date: Fri, 25 Jun 2004 15:27:11 -0700	[thread overview]
Message-ID: <20040625152711.60fa7ee1.akpm@digeo.com> (raw)
In-Reply-To: <200406252203.i5PM3m6s031728@voidhawk.shadowen.org>

Andy Whitcroft <apw@shadowen.org> wrote:
>
> As the comments in mmzone.h indicate is_highmem() is designed to
> reduce the proliferation of the constant ZONE_HIGHMEM.  This patch
> updates three references to ZONE_HIGHMEM to use is_highmem().
> None appear to be on critical paths.
> 
> Revision: $Rev: 305 $ 
> 
>  void __init set_highmem_pages_init(int bad_ppro) 
>  {
>  #ifdef CONFIG_HIGHMEM
> -	int nid;
> +	struct zone *zone;
>  
> -	for (nid = 0; nid < numnodes; nid++) {
> +	for_each_zone(zone) {
>  		unsigned long node_pfn, node_high_size, zone_start_pfn;
>  		struct page * zone_mem_map;
>  		
> -		node_high_size = NODE_DATA(nid)->node_zones[ZONE_HIGHMEM].spanned_pages;
> -		zone_mem_map = NODE_DATA(nid)->node_zones[ZONE_HIGHMEM].zone_mem_map;
> -		zone_start_pfn = NODE_DATA(nid)->node_zones[ZONE_HIGHMEM].zone_start_pfn;
> +		if (!is_highmem(zone))
> +			continue;
> +
> +		printk("Initializing %s for node %d\n", zone->name,
> +			zone->zone_pgdat->node_id);
> +
> +		node_high_size = zone->spanned_pages;
> +		zone_mem_map = zone->zone_mem_map;
> +		zone_start_pfn = zone->zone_start_pfn;
>  
> -		printk("Initializing highpages for node %d\n", nid);
>  		for (node_pfn = 0; node_pfn < node_high_size; node_pfn++) {
>  			one_highpage_init((struct page *)(zone_mem_map + node_pfn),
>  					  zone_start_pfn + node_pfn, bad_ppro);

Fair enough.

> @@ -930,11 +930,12 @@ unsigned int nr_free_pagecache_pages(voi
>  #ifdef CONFIG_HIGHMEM
>  unsigned int nr_free_highpages (void)
>  {
> -	pg_data_t *pgdat;
> +	struct zone *zone;
>  	unsigned int pages = 0;
>  
> -	for_each_pgdat(pgdat)
> -		pages += pgdat->node_zones[ZONE_HIGHMEM].free_pages;
> +	for_each_zone(zone)
> +		if (is_highmem(zone))
> +			pages += zone->free_pages;

but that's slower.


  reply	other threads:[~2004-06-25 22:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-25 22:03 Andy Whitcroft
2004-06-25 22:27 ` Andrew Morton [this message]
2004-06-25 22:46   ` Andy Whitcroft
2004-07-07 16:25   ` Andy Whitcroft

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=20040625152711.60fa7ee1.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®