Re: mem_map array on NUMA

From: David Rientjes
Date: Fri Nov 12 2010 - 13:36:25 EST


On Fri, 12 Nov 2010, Artur Baruchi wrote:

> Hi David.
>
> Thanks for your answer.
>
> Basically, I would like to get information about memory pages, without
> "worry" about which zone its owned. I tried to use the code you've send, but
> some macros are not beeing exported by the Kernel (I cannot use it in
> drivers/modules). Im facing the follow errors:
>
> *WARNING: "next_zone" [/root/DRIVER/xxxxxxxx.ko] undefined!
> WARNING: "first_online_pgdat" [/root/DRIVER/**xxxxxxxx.ko**] undefined!*
>
> Do you have any idea about how can I handle this error?
>

For your use-case, you can simply iterate through each pfn without
worrying about their zones, something like:

unsigned long pfn;

for (pfn = 0; pfn < max_pfn; pfn++) {
struct page *page;

if (!pfn_valid(pfn))
continue;
page = pfn_to_page(pfn);
/* do something with page */
}

> Thanks in advance.
>
> Att.
> Artur Baruchi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/