summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tapset/memory.stp59
-rw-r--r--testsuite/buildok/vm.tracepoints.kmalloc.stp9
-rw-r--r--testsuite/buildok/vm.tracepoints.stp5
3 files changed, 53 insertions, 20 deletions
diff --git a/tapset/memory.stp b/tapset/memory.stp
index bd71a386..c170c5c7 100644
--- a/tapset/memory.stp
+++ b/tapset/memory.stp
@@ -217,6 +217,33 @@ function __gfp_flag_str:string(gfp_flag:long) %{
#endif
#endif
+#ifndef __GFP_THISNODE
+#define __GFP_THISNODE ((__force gfp_t)0x40000u)
+#endif
+
+#ifndef __GFP_RECLAIMABLE
+#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u)
+#endif
+
+#ifndef GFP_TEMPORARY
+#define GFP_TEMPORARY (__GFP_WAIT | __GFP_IO | __GFP_FS | \
+ __GFP_RECLAIMABLE)
+#endif
+
+#ifndef GFP_HIGHUSER_MOVABLE
+#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
+ __GFP_HARDWALL | __GFP_HIGHMEM | \
+ __GFP_MOVABLE)
+#endif
+
+#ifndef GFP_THISNODE
+#ifdef CONFIG_NUMA
+#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
+#else
+#define GFP_THISNODE ((__force gfp_t)0)
+#endif
+#endif
+
/* Macro for GFP Bitmasks. */
/* The resulted GFP_FLAGS may be either single or concatenation of the multiple bitmasks. */
@@ -298,9 +325,9 @@ probe __vm.kmalloc.kp = kernel.function("kmalloc").return {
call_site = 0
caller_function = "unknown"
bytes_req = $size
- bytes_alloc = "unknown"
- gfp_flags = $gfp_flags
- gfp_flag_name = __gfp_flag_str($gfp_flags)
+ bytes_alloc = bytes_req // pretend they are always the same
+ gfp_flags = $flags
+ gfp_flag_name = __gfp_flag_str(gfp_flags)
ptr = $return
}
@@ -334,10 +361,10 @@ probe __vm.kmem_cache_alloc.kp = kernel.function("kmem_cache_alloc").return {
name = "kmem_cache_alloc"
call_site = 0
caller_function = "unknown"
- bytes_req = $size
- bytes_alloc = "unknown"
- gfp_flags = $gfp_flags
- gfp_flag_name = __gfp_flag_str($gfp_flags)
+ bytes_req = $cachep->buffer_size
+ bytes_alloc = bytes_req // pretend they are always the same
+ gfp_flags = $flags
+ gfp_flag_name = __gfp_flag_str(gfp_flags)
ptr = $return
}
@@ -373,9 +400,9 @@ probe __vm.kmalloc_node.kp = kernel.function("kmalloc_node").return? {
call_site = 0
caller_function = "unknown"
bytes_req = $size
- bytes_alloc = "unknown"
- gfp_flags = $gfp_flags
- gfp_flag_name = __gfp_flag_str($gfp_flags)
+ bytes_alloc = bytes_req // pretend they are always the same
+ gfp_flags = $flags
+ gfp_flag_name = __gfp_flag_str(gfp_flags)
ptr = $return
}
@@ -408,10 +435,10 @@ probe __vm.kmem_cache_alloc_node.kp = kernel.function("kmem_cache_alloc_node").r
name = "kmem_cache_alloc_node"
call_site = 0
caller_function = "unknown"
- bytes_req = $size
- bytes_alloc = "unknown"
- gfp_flags = $gfp_flags
- gfp_flag_name = __gfp_flag_str($gfp_flags)
+ bytes_req = $cachep->buffer_size
+ bytes_alloc = bytes_req // pretend they are always the same
+ gfp_flags = $flags
+ gfp_flag_name = __gfp_flag_str(gfp_flags)
ptr = $return
}
@@ -442,7 +469,7 @@ probe __vm.kfree.kp = kernel.function("kfree").return {
name = "kfree"
call_site = 0
caller_function = "unknown"
- ptr = $return
+ ptr = $objp
}
/**
@@ -465,7 +492,7 @@ probe __vm.kmem_cache_free.kp = kernel.function("kmem_cache_free").return {
name = "kmem_cache_free"
call_site = 0
caller_function = "unknown"
- ptr = $return
+ ptr = $objp
}
/**
* probe vm.kmem_cache_free - Fires when \
diff --git a/testsuite/buildok/vm.tracepoints.kmalloc.stp b/testsuite/buildok/vm.tracepoints.kmalloc.stp
new file mode 100644
index 00000000..f723737c
--- /dev/null
+++ b/testsuite/buildok/vm.tracepoints.kmalloc.stp
@@ -0,0 +1,9 @@
+#! stap -up4
+
+/* All other tracepoint memory probes are in another test vm.tracepoints.stp */
+
+probe vm.kmalloc {
+ println(name)
+ printf("%-15s %-15p %-15s %-15p %-15d %-15d %-15d %-15s \n", execname(), call_site, caller_function, ptr, bytes_req, bytes_alloc, gfp_flags, gfp_flag_name)
+}
+
diff --git a/testsuite/buildok/vm.tracepoints.stp b/testsuite/buildok/vm.tracepoints.stp
index 488ca0fc..6ed747d7 100644
--- a/testsuite/buildok/vm.tracepoints.stp
+++ b/testsuite/buildok/vm.tracepoints.stp
@@ -5,10 +5,7 @@ probe vm.kfree {
printf("%-15s %-15p %-15s %-15p \n", execname(), call_site, caller_function, ptr)
}
-probe vm.kmalloc {
- println(name)
- printf("%-15s %-15p %-15s %-15p %-15d %-15d %-15d %-15s \n", execname(), call_site, caller_function, ptr, bytes_req, bytes_alloc, gfp_flags, gfp_flag_name)
-}
+/* vm.kmalloc is in a separate test vm.tracepoints.kmalloc.stp */
probe vm.kmem_cache_alloc {
println(name)