summaryrefslogtreecommitdiff
path: root/lib/intel_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/intel_os.c')
-rw-r--r--lib/intel_os.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/intel_os.c b/lib/intel_os.c
index 83368c29..64d87e36 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -185,6 +185,27 @@ intel_get_total_swap_mb(void)
return retval / (1024*1024);
}
+/**
+ * intel_check_memory:
+ * @count: number of surfaces that will be created
+ * @size: the size in bytes of each surface
+ * @mode: a bitfield declaring whether the test will be run in RAM or in SWAP
+ *
+ * Computes the total amount of memory required to allocate @count surfaces,
+ * each of @size bytes, and includes an estimate for kernel overhead. It then
+ * queries the kernel for the avilable amount of memory on the system (either
+ * RAM and/or SWAP depending upon @mode) and determines whether there is
+ * sufficient to run the test.
+ *
+ * Most tests should check that there is enough RAM to hold their working set.
+ * The rare swap thrashing tests should check that there is enough RAM + SWAP
+ * for their tests. oom-killer tests should only run if this reports that
+ * there is not enought RAM + SWAP!
+ *
+ * Returns:
+ * Whether the estimated amount of memory required for the objects
+ * fits in the available memory on the system.
+ */
bool intel_check_memory(uint32_t count, uint32_t size, unsigned mode)
{
/* rough estimate of how many bytes the kernel requires to track each object */