Messages in this thread | | | Date | Thu, 11 Nov 2010 13:18:02 -0800 (PST) | From | David Rientjes <> | Subject | Re: mem_map array on NUMA |
| |
On Thu, 11 Nov 2010, Artur Baruchi wrote:
> Hi. > > Im developing a module that get some information about memory pages. > This module worked fine on non-NUMA machine, I was able to walk > through the memory using the mem_map array. But, when I tried to > compile this module in a NUMA machine, the mem_map is not beeing > exported and I cannot use it. >
You're no longer using flatmem in that case.
> Does anybody knows what can be used to substitute the mem_map array in > a NUMA machine ? Im using the kernel 2.6.35, and the > comments/documentations for newer kernels seems to be outdated. >
It depends on what pages you want to iterate through: pageblock, zone, node, or the entire system. You didn't say what information you're trying to obtain, so it's difficult to know whether you want to only look at pages within a certain zone or node, pageblocks that are migratable, pages mapped by a certain task, etc.
For pages bound to a certain mm or vma, I'd recommend using the walk_page_range() interface. For zone iterations, do:
struct zone *zone;
for_each_populated_zone(zone) { spin_lock(&zone->lock); for (pfn = zone->zone_start_pfn; pfn < zone->zone_start_pfn + zone->spanned_pages; pfn++) { if (pfn_valid(pfn)) { struct page *page = pfn_to_page(pfn); /* do something with page */ } } spin_unlock(&zone->lock); }
Or you could iterate through node_zonelists for only a specified node of interest.
| |