You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2015/12/01 23:00:15 UTC
[1/2] mesos git commit: Added swap information to os::memory().
Repository: mesos
Updated Branches:
refs/heads/master 773b0c7ea -> c3dd3edb6
Added swap information to os::memory().
Review: https://reviews.apache.org/r/38233
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5a21baa7
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5a21baa7
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5a21baa7
Branch: refs/heads/master
Commit: 5a21baa762d726ed22aaa4e14ba4f956d6132a5a
Parents: 773b0c7
Author: Chi Zhang <ch...@gmail.com>
Authored: Tue Dec 1 13:56:16 2015 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Dec 1 13:56:16 2015 -0800
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/os/os.hpp | 2 ++
.../3rdparty/stout/include/stout/posix/os.hpp | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a21baa7/3rdparty/libprocess/3rdparty/stout/include/stout/os/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/os.hpp
index 822b347..2ec2d9a 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/os.hpp
@@ -35,6 +35,8 @@ struct Memory
{
Bytes total;
Bytes free;
+ Bytes totalSwap;
+ Bytes freeSwap;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a21baa7/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
index 95f3328..99e0ae4 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
@@ -584,9 +584,13 @@ inline Try<Memory> memory()
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 23)
memory.total = Bytes(info.totalram * info.mem_unit);
memory.free = Bytes(info.freeram * info.mem_unit);
+ memory.totalSwap = Bytes(info.totalswap * info.mem_unit);
+ memory.freeSwap = Bytes(info.freeswap * info.mem_unit);
# else
memory.total = Bytes(info.totalram);
memory.free = Bytes(info.freeram);
+ memory.totalSwap = Bytes(info.totalswap);
+ memory.freeSwap = Bytes(info.freeswap);
# endif
return memory;
@@ -619,6 +623,19 @@ inline Try<Memory> memory()
}
memory.free = Bytes(freeCount * pageSize);
+ struct xsw_usage usage;
+ length = sizeof(struct xsw_usage);
+ if (sysctlbyname(
+ "vm.swapusage",
+ &usage,
+ &length,
+ NULL,
+ 0) != 0) {
+ return ErrnoError();
+ }
+ memory.totalSwap = Bytes(usage.xsu_total * pageSize);
+ memory.freeSwap = Bytes(usage.xsu_avail * pageSize);
+
return memory;
#else
[2/2] mesos git commit: Checked if swap is enabled before running
memory pressure related tests.
Posted by vi...@apache.org.
Checked if swap is enabled before running memory pressure related
tests.
Review: https://reviews.apache.org/r/38234
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c3dd3edb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c3dd3edb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c3dd3edb
Branch: refs/heads/master
Commit: c3dd3edb6f09de4333645cb87ba25c9d1c8969c3
Parents: 5a21baa
Author: Chi Zhang <ch...@gmail.com>
Authored: Tue Dec 1 13:56:49 2015 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Dec 1 13:59:53 2015 -0800
----------------------------------------------------------------------
src/tests/containerizer/cgroups_tests.cpp | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c3dd3edb/src/tests/containerizer/cgroups_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cgroups_tests.cpp b/src/tests/containerizer/cgroups_tests.cpp
index 919ff19..5e15d44 100644
--- a/src/tests/containerizer/cgroups_tests.cpp
+++ b/src/tests/containerizer/cgroups_tests.cpp
@@ -555,6 +555,17 @@ TEST_F(CgroupsAnyHierarchyWithCpuMemoryTest, ROOT_CGROUPS_Listen)
<< "this test.\n"
<< "-------------------------------------------------------------";
+ Try<os::Memory> memory = os::memory();
+ ASSERT_SOME(memory);
+
+ // TODO(vinod): Instead of asserting here dynamically disable
+ // the test if swap is enabled on the host.
+ ASSERT_EQ(memory.get().totalSwap, Bytes(0))
+ << "-------------------------------------------------------------\n"
+ << "We cannot run this test because it appears you have swap\n"
+ << "enabled, but feel free to disable this test.\n"
+ << "-------------------------------------------------------------";
+
const Bytes limit = Megabytes(64);
ASSERT_SOME(cgroups::memory::limit_in_bytes(
@@ -1073,6 +1084,17 @@ protected:
TEST_F(CgroupsAnyHierarchyMemoryPressureTest, ROOT_IncreaseRSS)
{
+ Try<os::Memory> memory = os::memory();
+ ASSERT_SOME(memory);
+
+ // TODO(vinod): Instead of asserting here dynamically disable
+ // the test if swap is enabled on the host.
+ ASSERT_EQ(memory.get().totalSwap, Bytes(0))
+ << "-------------------------------------------------------------\n"
+ << "We cannot run this test because it appears you have swap\n"
+ << "enabled, but feel free to disable this test.\n"
+ << "-------------------------------------------------------------";
+
MemoryTestHelper helper;
ASSERT_SOME(helper.spawn());
ASSERT_SOME(helper.pid());