summaryrefslogtreecommitdiff
path: root/lib/intel_os.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-04-07 13:09:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-04-07 13:12:29 +0100
commitff7806e52c4e9b7c522e59ba8514c5c6e3fa8683 (patch)
treedd61aec2c0beddc9b4078a599bc62ac2d57ae1fb /lib/intel_os.c
parent5d607a744f3df07235355ebcb5376e2464e2f4b1 (diff)
gem_tiled_swapping: Purge all page/swap caches first
Reset the system to a vanilla state before we query how much RAM/swap space is available for our testing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/intel_os.c')
-rw-r--r--lib/intel_os.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/intel_os.c b/lib/intel_os.c
index 6f0621c7..7d9a703a 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -185,6 +185,19 @@ intel_get_total_swap_mb(void)
return retval / (1024*1024);
}
+void
+intel_purge_vm_caches(void)
+{
+ int fd;
+
+ fd = open("/proc/sys/vm/drop_caches", O_RDWR);
+ if (fd < 0)
+ return;
+
+ write(fd, "3\n", 2);
+ close(fd);
+}
+
/*
* When testing a port to a new platform, create a standalone test binary