Repository: mesos Updated Branches: refs/heads/master 4b8767103 -> 0f48a4513
Changed MemoryTestHelper to do memset before mlock. In allocateRSS, when requested memory is more than the limit, mlock returns error because it couldn't find enough lockable memory, which defeats the purpose to trigger an oom. Review: https://reviews.apache.org/r/33644 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0f48a451 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0f48a451 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0f48a451 Branch: refs/heads/master Commit: 0f48a4513b8c6f1a3a22d4f8ccb8a51941c5b599 Parents: 4b87671 Author: Chi Zhang <[email protected]> Authored: Wed Apr 29 10:17:01 2015 -0700 Committer: Jie Yu <[email protected]> Committed: Wed Apr 29 10:17:02 2015 -0700 ---------------------------------------------------------------------- src/tests/memory_test_helper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/0f48a451/src/tests/memory_test_helper.cpp ---------------------------------------------------------------------- diff --git a/src/tests/memory_test_helper.cpp b/src/tests/memory_test_helper.cpp index cdf769b..8093e66 100644 --- a/src/tests/memory_test_helper.cpp +++ b/src/tests/memory_test_helper.cpp @@ -80,14 +80,14 @@ static Try<void*> allocateRSS(const Bytes& size, bool lock = true) return ErrnoError("Failed to increase RSS memory, posix_memalign"); } + // Use memset to actually page in the memory in the kernel. + memset(rss, 1, size.bytes()); + // Locking a page makes it unevictable in the kernel. if (lock && mlock(rss, size.bytes()) != 0) { return ErrnoError("Failed to lock memory, mlock"); } - // Use memset to actually page in the memory in the kernel. - memset(rss, 1, size.bytes()); - return rss; }
