Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] do not count pages in holes with sparsemem
Date: Wed, 05 Jul 2006 15:58:52 +0200	[thread overview]
Message-ID: <44ABC59C.6070607@innova-card.com> (raw)
In-Reply-To: <20060705.221354.74751389.anemo@mba.ocn.ne.jp>

Atsushi Nemoto wrote:
> With SPARSEMEM, the single node can contains some holes so there might
> be many invalid pages.  For example, with two 256M memory and one 256M

Does SPARSEMEM is the only memory model where we can have memory holes ?

> hole, some variables (num_physpage, totalpages, nr_kernel_pages,
> nr_all_pages, etc.) will indicate that there are 768MB on this system.
> This is not desired because, for example, alloc_large_system_hash()
> allocates too many entries.
> 
> Use free_area_init_node() with counted zholes_size[] instead of
> free_area_init().
> 
> For num_physpages, use number of ram pages instead of max_low_pfn.
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> 
> diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
> index 802bdd3..d41dee5 100644
> --- a/arch/mips/mm/init.c
> +++ b/arch/mips/mm/init.c

[snip]

>  
> @@ -174,29 +200,17 @@ #ifdef CONFIG_HIGHMEM
>  		zones_size[ZONE_HIGHMEM] = high - low;
>  #endif
>  
> +#ifdef CONFIG_SPARSEMEM
> +	pfn = 0;
> +	for (i = 0; i < MAX_NR_ZONES; i++)
> +		for (j = 0; j < zones_size[i]; j++, pfn++)
> +			if (!page_is_ram(pfn))
> +				zholes_size[i]++;
> +	free_area_init_node(0, NODE_DATA(0), zones_size,
> +			    __pa(PAGE_OFFSET), zholes_size);


Does this code really need the ifdef CONFIG_SPARSEMEM ? Can't we make
it generic instead. Only zholes_size[] initialisation really depends
on the memory model. Of course FLATMEM will let zholes_size as is...

If I remember correctly free_area_init_node() takes a pfn number as
fourth parameter: __pa(PAGE_OFFSET) results in a physical address...

BTW why using __pa(OFFSET) ? isn't it going to yield always into 0 ?
At least on MIPS, it's defined as

#define __pa(x)	((unsigned long) (x) - PAGE_OFFSET)

why not using ARCH_PFN_OFFSET instead ?

thanks

		Franck

  reply	other threads:[~2006-07-05 13:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-05 13:13 [PATCH] do not count pages in holes with sparsemem Atsushi Nemoto
2006-07-05 13:58 ` Franck Bui-Huu [this message]
2006-07-05 14:17   ` Atsushi Nemoto
2006-07-06 13:12     ` Franck Bui-Huu
2006-07-06 14:36       ` Atsushi Nemoto
2006-07-06 14:59         ` Franck Bui-Huu
2006-07-06 15:05           ` Franck Bui-Huu
2006-07-06 15:26             ` Atsushi Nemoto
2006-07-08 14:39               ` Franck Bui-Huu
2006-07-08 16:03                 ` Atsushi Nemoto
2006-07-08 16:15                   ` Franck Bui-Huu
2006-07-09 12:56                     ` Atsushi Nemoto
2006-07-10 11:34               ` Franck Bui-Huu
2006-07-10 14:34                 ` Atsushi Nemoto
2006-07-11  8:33                   ` Franck Bui-Huu
2006-07-11 13:24                     ` Atsushi Nemoto
2006-07-26 14:33                       ` Franck Bui-Huu
2006-07-26 15:21                         ` Atsushi Nemoto
2006-07-27  9:00                           ` Franck Bui-Huu
2006-07-28 12:48                             ` Atsushi Nemoto
2006-09-24  9:48 ` girish

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=44ABC59C.6070607@innova-card.com \
    --to=vagabon.xyz@gmail.com \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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