aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric B Munson <ebmunson@us.ibm.com>2008-04-15 10:39:01 -0700
committerNishanth Aravamudan <nacc@us.ibm.com>2008-04-15 17:04:40 -0700
commita6249347146c8f4b783fd742f2ead0ce13cb33f3 (patch)
tree1e824969c7d1472e6a68774dc91f52927a50663c
parent0991ce9c0657f24899da64bc2d4df2736c565b7a (diff)
downloadlibhugetlbfs-a6249347146c8f4b783fd742f2ead0ce13cb33f3.tar.gz
Check MEMLOCK limit in mlock test
Ensure that the locked memory limit is bigger than a huge page before trying the test. Signed-off-by: Eric Munson <ebmunson@us.ibm.com> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
-rw-r--r--tests/mlock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/mlock.c b/tests/mlock.c
index f660387..88859f3 100644
--- a/tests/mlock.c
+++ b/tests/mlock.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <errno.h>
#include <sys/mman.h>
+#include <sys/resource.h>
#include <hugetlbfs.h>
#include "hugetests.h"
@@ -57,6 +58,12 @@ static void test_simple_mlock(int flags)
int main(int argc, char *argv[])
{
+ struct rlimit limit_info;
+ if(getrlimit(RLIMIT_MEMLOCK, &limit_info))
+ ERROR("Unable to read locked memory rlimit: %s", strerror(errno));
+ if(limit_info.rlim_cur < check_hugepagesize())
+ CONFIG("Locked memory ulimit set below huge page size");
+
test_simple_mlock(MAP_PRIVATE);
test_simple_mlock(MAP_SHARED);
test_simple_mlock(MAP_PRIVATE|MAP_LOCKED);