summaryrefslogtreecommitdiffstats
path: root/tapset/memory.stp
blob: 2682b5a7f96f8342384d3a5ca5837f8a5f338a94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// memory related tapset
// Copyright (C) 2005, 2006 IBM Corp.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

/* Record the page fault event */
probe pagefault
	=  kernel.function(%( kernel_v >= "2.6.13" %? "__handle_mm_fault"
                                          %: "handle_mm_fault" %))
{
	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;
                }

%}