diff options
author | guanglei <guanglei> | 2006-07-04 03:57:49 +0000 |
---|---|---|
committer | guanglei <guanglei> | 2006-07-04 03:57:49 +0000 |
commit | 6b6427637595a0386674a51c65449f3004115a91 (patch) | |
tree | 7c982bd7443ca111c0c6a0af3ad268b716c7c0f5 /tapset/memory.stp | |
parent | ae0025b3661fafdddfe0a24695f385accc7c2cbf (diff) | |
download | systemtap-steved-6b6427637595a0386674a51c65449f3004115a91.tar.gz systemtap-steved-6b6427637595a0386674a51c65449f3004115a91.tar.xz systemtap-steved-6b6427637595a0386674a51c65449f3004115a91.zip |
add addr_to_node() from Jose Santos
Diffstat (limited to 'tapset/memory.stp')
-rw-r--r-- | tapset/memory.stp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tapset/memory.stp b/tapset/memory.stp index 9289ae5e..2682b5a7 100644 --- a/tapset/memory.stp +++ b/tapset/memory.stp @@ -14,3 +14,19 @@ probe pagefault write_access = $write_access address = $address } + +/* Return which node the given address belongs to in a NUMA system */ +function addr_to_node:long(addr:long) /* pure */ +%{ + int nid; + int pfn = __pa(THIS->addr) >> PAGE_SHIFT; + for_each_online_node(nid) + if ( node_start_pfn(nid) <= pfn && + pfn < (node_start_pfn(nid) + + NODE_DATA(nid)->node_spanned_pages) ) + { + THIS->__retvalue = nid; + break; + } + +%} |