summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 11:00:30 +0000
committerpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 11:00:30 +0000
commit787b3c6b95890fe128c642bcdfcd8bb0060846d7 (patch)
tree54b194439340329aa808cc3579bbdb90fdc5130a /third_party
parentff2bd1be8e8b7b6d10018cf654e676890a02898b (diff)
downloadchromium_src-787b3c6b95890fe128c642bcdfcd8bb0060846d7.zip
chromium_src-787b3c6b95890fe128c642bcdfcd8bb0060846d7.tar.gz
chromium_src-787b3c6b95890fe128c642bcdfcd8bb0060846d7.tar.bz2
Purge unpinned ashmem before parsing /proc/$pid/smaps.
This will help stabilize memory measurements so that memory regressions can't be hidden when unpinned ashmem gets purged by the kernel. BUG=311633 Review URL: https://codereview.chromium.org/52833002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/ashmem/ashmem-dev.c10
-rw-r--r--third_party/ashmem/ashmem.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/third_party/ashmem/ashmem-dev.c b/third_party/ashmem/ashmem-dev.c
index 1cfdfe0..2303369 100644
--- a/third_party/ashmem/ashmem-dev.c
+++ b/third_party/ashmem/ashmem-dev.c
@@ -88,3 +88,13 @@ int ashmem_get_size_region(int fd)
{
return ioctl(fd, ASHMEM_GET_SIZE, NULL);
}
+
+int ashmem_purge_all(void)
+{
+ const int fd = open(ASHMEM_DEVICE, O_RDWR);
+ if (fd < 0)
+ return fd;
+ const int ret = ioctl(fd, ASHMEM_PURGE_ALL_CACHES, 0);
+ close(fd);
+ return ret;
+}
diff --git a/third_party/ashmem/ashmem.h b/third_party/ashmem/ashmem.h
index 708dd45..7d411cc 100644
--- a/third_party/ashmem/ashmem.h
+++ b/third_party/ashmem/ashmem.h
@@ -21,6 +21,7 @@ int ashmem_set_prot_region(int fd, int prot);
int ashmem_pin_region(int fd, size_t offset, size_t len);
int ashmem_unpin_region(int fd, size_t offset, size_t len);
int ashmem_get_size_region(int fd);
+int ashmem_purge_all(void);
#ifdef __cplusplus
}