]> sourceware.org Git - systemtap.git/commitdiff
Tapset: proc_mem_rss() now includes resident shared mem pages.
authorYichun Zhang (agentzh) <yichun@openresty.com>
Sat, 4 Jan 2020 00:09:07 +0000 (16:09 -0800)
committerYichun Zhang (agentzh) <yichun@openresty.com>
Sat, 4 Jan 2020 00:09:09 +0000 (16:09 -0800)
The return value finally matches the VmRSS field in /proc/PID/status
now.

The old behavior can be restored by the --compatible=4.2 option
on the command line.

Thanks Dejiang Zhu for reporting this issue.

NEWS
tapset/linux/proc_mem.stp

diff --git a/NEWS b/NEWS
index aabace6a1758d85724a7824f7bb787f37a267829..313d35a5e4ae2c22360e5bb88dd8e8fd0ff32db0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@
 - The process(EXE).begin probe handlers are now always triggered for
   already-running target processes.
 
+- The proc_mem_rss() tapset function now includes the resident shared
+  memory pages as expected. The old behavior can be restored by the
+  --compatible=4.2 option on the command line.
+
 * What's new in version 4.2, 2019-11-18
 
 - Initial support for multi-dimensional supports has been added to
index 2b152f6ae9bea3185a47c004897854dc4a17e4e2..1208a228736e2d9584e3a254ee7295aea50b7500 100644 (file)
@@ -71,6 +71,13 @@ enum {
        return @const("MM_ANONPAGES")
 }
 
+%(systemtap_v > "4.2" %?
+@__private30 function _MM_SHMEMPAGES:long()
+{
+       return @const("MM_SHMEMPAGES")
+}
+%)
+
 @__private30 function _stp_get_mm_counter:long(mm_ptr:long, member:long)
 {
     mm = & @mm(mm_ptr)
@@ -167,7 +174,11 @@ function proc_mem_rss:long ()
     mm = @task(task)->mm
     if (mm != 0)
       return (_stp_get_mm_counter(mm, _MM_FILEPAGES())
-             + _stp_get_mm_counter(mm, _MM_ANONPAGES()))
+             + _stp_get_mm_counter(mm, _MM_ANONPAGES())
+%(systemtap_v > "4.2" %?
+             + _stp_get_mm_counter(mm, _MM_SHMEMPAGES())
+%)
+              )
   }
   return 0
 }
@@ -188,7 +199,11 @@ function proc_mem_rss:long (pid:long)
     mm = @task(task)->mm
     if (mm != 0)
         return (_stp_get_mm_counter(mm, _MM_FILEPAGES())
-                + _stp_get_mm_counter(mm, _MM_ANONPAGES()))
+                + _stp_get_mm_counter(mm, _MM_ANONPAGES())
+%(systemtap_v > "4.2" %?
+             + _stp_get_mm_counter(mm, _MM_SHMEMPAGES())
+%)
+                )
   }
   return 0
 }
This page took 0.031441 seconds and 5 git commands to generate.