-
-
Save agentzh/f28a1c9b4502ddb305fd4f6b3e2b49d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/NEWS b/NEWS | |
index aabace6a1..313d35a5e 100644 | |
--- 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 | |
diff --git a/tapset/linux/proc_mem.stp b/tapset/linux/proc_mem.stp | |
index 2b152f6ae..1208a2287 100644 | |
--- a/tapset/linux/proc_mem.stp | |
+++ b/tapset/linux/proc_mem.stp | |
@@ -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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment