summaryrefslogtreecommitdiff
path: root/src/zmalloc.c
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2019-09-20 11:01:36 +0100
committerDavid Carlier <devnexen@gmail.com>2019-09-20 11:01:36 +0100
commit5a8a0050269382d94d88016ba04272eef658bc97 (patch)
treef84ddd615e9792ed1f482652a467208545ca0426 /src/zmalloc.c
parent819a661be5efcb045be4d34d7269ab35dc0fcb88 (diff)
downloadredis-5a8a0050269382d94d88016ba04272eef658bc97.tar.gz
Adding AnonHugePages case + comments
Diffstat (limited to 'src/zmalloc.c')
-rw-r--r--src/zmalloc.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 48f4b1e99..764738636 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -395,15 +395,24 @@ size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
return bytes;
}
#else
+/* Get sum of the specified field from libproc api call.
+ * As there are per page value basis we need to convert
+ * them accordingly.
+ *
+ * Note that AnonHugePages is a no-op as THP feature
+ * is not supported in this platform
+ */
size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
#if defined(__APPLE__)
struct proc_regioninfo pri;
if (proc_pidinfo(pid, PROC_PIDREGIONINFO, 0, &pri, PROC_PIDREGIONINFO_SIZE) ==
PROC_PIDREGIONINFO_SIZE) {
- if (!strcmp(field, "Private_Dirty")) {
+ if (!strcmp(field, "Private_Dirty:")) {
return (size_t)pri.pri_pages_dirtied * 4096;
- } else if (!strcmp(field, "Rss")) {
+ } else if (!strcmp(field, "Rss:")) {
return (size_t)pri.pri_pages_resident * 4096;
+ } else if (!strcmp(field, "AnonHugePages:")) {
+ return 0;
}
}
return 0;