lkml.org 
[lkml]   [2010]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: 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.


    \
     
     \ /
      Last update: 2010-11-11 22:21    [W:2.987 / U:0.388 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site