summaryrefslogtreecommitdiff
path: root/lib/intel_os.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-10 14:29:00 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-10 14:29:27 +0100
commit210d20f413626321c0c1650b97d1cb0f0b400c2d (patch)
tree524f7c56dea8e23ef42e3d06794b323a4ffccd97 /lib/intel_os.c
parent0617b0b3b897f7a070466af400da55e2b234e9be (diff)
API docs for intel_check_memory()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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 */