From 6b6427637595a0386674a51c65449f3004115a91 Mon Sep 17 00:00:00 2001 From: guanglei Date: Tue, 4 Jul 2006 03:57:49 +0000 Subject: add addr_to_node() from Jose Santos --- tapset/memory.stp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tapset/memory.stp') 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; + } + +%} -- cgit