linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: moreau francis <francis_moreau2000@yahoo.fr>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: Re : Re : sparsemem usage
Date: Thu, 03 Aug 2006 10:47:02 +0100	[thread overview]
Message-ID: <44D1C616.1060305@shadowen.org> (raw)
In-Reply-To: <20060803090706.99884.qmail@web25813.mail.ukl.yahoo.com>

moreau francis wrote:
> Alan Cox wrote:
>> Mapping out parts of a section is quite normal - think about the 640K to
>> 1Mb hole in PC memory space.
> 
> OK. But I'm still worry. Please consider the following code
> 
>        for (...; ...; ...) {
>                 [...]
>                 if (pfn_valid(i))
>                        num_physpages++;
>                 [...]
>         }
> 
> In that case num_physpages won't store an accurate value. Still it will be
> used by the kernel to make some statistic assumptions on other kernel
> data structure sizes.

That would be incorrect usage.  pfn_valid() simply doesn't tell you if 
you have memory backing a pfn, it mearly means you can interrogate the 
page* for it.  A good example of code which counts pages in a region is 
in count_highmem_pages() which has a form as below:

			for (pfn = start; pfn < end; pfn++) {
  				if (!pfn_valid(pfn))
                                         continue;
                                 page = pfn_to_page(pfn);
                                 if (PageReserved(page))
                                         continue;
				num_physpages++;
			}

-apw

  parent reply	other threads:[~2006-08-03  9:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-03  9:07 Re : Re : sparsemem usage moreau francis
2006-08-03  9:19 ` KAMEZAWA Hiroyuki
2006-08-03  9:47 ` Andy Whitcroft [this message]
2006-08-03 12:46   ` Re : " moreau francis
2006-08-03 13:13     ` Andy Whitcroft
2006-08-09 14:19       ` Re : " moreau francis
2006-08-10  4:46         ` KAMEZAWA Hiroyuki
2006-08-10 12:40           ` moreau francis
2006-08-10 12:49             ` KAMEZAWA Hiroyuki
  -- strict thread matches above, loose matches on Subject: below --
2006-08-10 15:21 Andy Whitcroft
2006-08-10 15:37 ` Re : " moreau francis
2006-08-11  8:26   ` Andy Whitcroft
2006-08-10 15:05 KAMEZAWA Hiroyuki
2006-08-10 15:23 ` Re : " moreau francis
2006-08-02 15:36 Andy Whitcroft
2006-08-03  9:56 ` Re : " moreau francis

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=44D1C616.1060305@shadowen.org \
    --to=apw@shadowen.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=francis_moreau2000@yahoo.fr \
    --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;
as well as URLs for NNTP newsgroup(s).