[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44D1C616.1060305@shadowen.org>
Date: Thu, 03 Aug 2006 10:47:02 +0100
From: Andy Whitcroft <apw@...dowen.org>
To: moreau francis <francis_moreau2000@...oo.fr>
CC: Alan Cox <alan@...rguk.ukuu.org.uk>, linux-kernel@...r.kernel.org
Subject: Re: Re : Re : sparsemem usage
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists