You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2018/06/19 06:37:12 UTC

[1/6] mesos git commit: Added `windows/cpu` and `windows/mem` isolators into `agent.md`.

Repository: mesos
Updated Branches:
  refs/heads/master fb7dceef1 -> 00ce78bd7


Added `windows/cpu` and `windows/mem` isolators into `agent.md`.

Review: https://reviews.apache.org/r/67335/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f4729e3e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f4729e3e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f4729e3e

Branch: refs/heads/master
Commit: f4729e3ebe9e5ad51a500ef348d9e1ea584eb424
Parents: fb7dcee
Author: Qian Zhang <zh...@gmail.com>
Authored: Mon Jun 18 23:23:29 2018 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Mon Jun 18 23:36:49 2018 -0700

----------------------------------------------------------------------
 docs/configuration/agent.md | 9 +++++----
 src/uri/fetcher.cpp         | 3 +++
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f4729e3e/docs/configuration/agent.md
----------------------------------------------------------------------
diff --git a/docs/configuration/agent.md b/docs/configuration/agent.md
index d2b6b82..2ea22ba 100644
--- a/docs/configuration/agent.md
+++ b/docs/configuration/agent.md
@@ -1027,13 +1027,14 @@ containers running on the host network.
     --isolation=VALUE
   </td>
   <td>
-Isolation mechanisms to use, e.g., <code>posix/cpu,posix/mem</code>, or
+Isolation mechanisms to use, e.g., <code>posix/cpu,posix/mem</code> (or
+<code>windows/cpu,windows/mem</code> if you are on Windows), or
 <code>cgroups/cpu,cgroups/mem</code>, or <code>network/port_mapping</code>
 (configure with flag: <code>--with-network-isolator</code> to enable),
 or <code>gpu/nvidia</code> for nvidia specific gpu isolation, or load an alternate
-isolator module using the <code>--modules</code> flag. Note that this
-flag is only relevant for the Mesos Containerizer.
-(default: posix/cpu,posix/mem)
+isolator module using the <code>--modules</code> flag. Note that this flag is only
+relevant for the Mesos Containerizer. (default: windows/cpu,windows/mem on Windows;
+posix/cpu,posix/mem on other platforms)
   </td>
 </tr>
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f4729e3e/src/uri/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/uri/fetcher.cpp b/src/uri/fetcher.cpp
index 489c7ce..211dd1c 100644
--- a/src/uri/fetcher.cpp
+++ b/src/uri/fetcher.cpp
@@ -108,6 +108,9 @@ Future<Nothing> Fetcher::fetch(
     const string& directory,
     const Option<string>& data) const
 {
+  foreachkey (const string& key, pluginsByScheme) {
+    std::cout << "!!!: " << key << std::endl;
+  }
   if (!pluginsByScheme.contains(uri.scheme())) {
     return Failure("Scheme '" + uri.scheme() + "' is not supported");
   }


[6/6] mesos git commit: Made `PerfEventSubsystemProcess` can be created without `--perf_events`.

Posted by gi...@apache.org.
Made `PerfEventSubsystemProcess` can be created without `--perf_events`.

If the agent flag `--perf_events` is not specified, the `perf_event`
subsystem (i.e., `PerfEventSubsystemProcess`) can still be created, but
it will not do sampling at all. The reason that we want to do this is,
in some cases, even it is not required to sample any events, we still
want each container to have its own `perf_event` cgroup instead under
the root cgroup.

Review: https://reviews.apache.org/r/67574/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/11f1a7c5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/11f1a7c5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/11f1a7c5

Branch: refs/heads/master
Commit: 11f1a7c509f82076b1bce1a24ccfdf370686aec0
Parents: bb670f1
Author: Qian Zhang <zh...@gmail.com>
Authored: Mon Jun 18 23:23:42 2018 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Mon Jun 18 23:36:50 2018 -0700

----------------------------------------------------------------------
 .../isolators/cgroups/subsystems/perf_event.cpp      | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/11f1a7c5/src/slave/containerizer/mesos/isolators/cgroups/subsystems/perf_event.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/perf_event.cpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/perf_event.cpp
index 06eca0c..180afc9 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/perf_event.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/perf_event.cpp
@@ -44,6 +44,13 @@ Try<Owned<SubsystemProcess>> PerfEventSubsystemProcess::create(
     const Flags& flags,
     const string& hierarchy)
 {
+  // If the agent flag `--perf_events` is not specified, we will not do sampling
+  // at all, so this subsystem is just like a no-op in this case.
+  if (flags.perf_events.isNone()) {
+    return Owned<SubsystemProcess>(
+        new PerfEventSubsystemProcess(flags, hierarchy, set<string>{}));
+  }
+
   if (!perf::supported()) {
     return Error("Perf is not supported");
   }
@@ -54,10 +61,6 @@ Try<Owned<SubsystemProcess>> PerfEventSubsystemProcess::create(
         "interval (" + stringify(flags.perf_interval) + ") is not supported.");
   }
 
-  if (!flags.perf_events.isSome()) {
-    return Error("No perf events specified");
-  }
-
   set<string> events;
   foreach (const string& event,
            strings::tokenize(flags.perf_events.get(), ",")) {
@@ -90,7 +93,9 @@ PerfEventSubsystemProcess::PerfEventSubsystemProcess(
 void PerfEventSubsystemProcess::initialize()
 {
   // Start sampling.
-  sample();
+  if (!events.empty()) {
+    sample();
+  }
 }
 
 


[4/6] mesos git commit: Added `cgroups/all` into the agent flag `--isolation`.

Posted by gi...@apache.org.
Added `cgroups/all` into the agent flag `--isolation`.

Review: https://reviews.apache.org/r/67342/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bb670f16
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bb670f16
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bb670f16

Branch: refs/heads/master
Commit: bb670f161e4c022988b6d00ea3bd11b10aa28236
Parents: f4729e3
Author: Qian Zhang <zh...@gmail.com>
Authored: Mon Jun 18 23:23:37 2018 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Mon Jun 18 23:36:50 2018 -0700

----------------------------------------------------------------------
 docs/configuration/agent.md | 9 ++++++---
 src/slave/flags.cpp         | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bb670f16/docs/configuration/agent.md
----------------------------------------------------------------------
diff --git a/docs/configuration/agent.md b/docs/configuration/agent.md
index 2ea22ba..68dad42 100644
--- a/docs/configuration/agent.md
+++ b/docs/configuration/agent.md
@@ -1032,9 +1032,12 @@ Isolation mechanisms to use, e.g., <code>posix/cpu,posix/mem</code> (or
 <code>cgroups/cpu,cgroups/mem</code>, or <code>network/port_mapping</code>
 (configure with flag: <code>--with-network-isolator</code> to enable),
 or <code>gpu/nvidia</code> for nvidia specific gpu isolation, or load an alternate
-isolator module using the <code>--modules</code> flag. Note that this flag is only
-relevant for the Mesos Containerizer. (default: windows/cpu,windows/mem on Windows;
-posix/cpu,posix/mem on other platforms)
+isolator module using the <code>--modules</code> flag. If <code>cgroups/all</code>
+is specified, any other cgroups related isolation options (e.g.,
+<code>cgroups/cpu</code>) will be ignored, and all the local enabled cgroups
+subsystems on the agent host will be automatically loaded by the cgroups isolator.
+Note that this flag is only relevant for the Mesos Containerizer. (default:
+windows/cpu,windows/mem on Windows; posix/cpu,posix/mem on other platforms)
   </td>
 </tr>
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/bb670f16/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 8e448d8..fe182a9 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -122,14 +122,17 @@ mesos::internal::slave::Flags::Flags()
 
   add(&Flags::isolation,
       "isolation",
-      "Isolation mechanisms to use, e.g., `posix/cpu,posix/mem` (or \n"
+      "Isolation mechanisms to use, e.g., `posix/cpu,posix/mem` (or\n"
       "`windows/cpu,windows/mem` if you are on Windows), or\n"
       "`cgroups/cpu,cgroups/mem`, or `network/port_mapping`\n"
       "(configure with flag: `--with-network-isolator` to enable),\n"
       "or `gpu/nvidia` for nvidia specific gpu isolation,\n"
       "or load an alternate isolator module using the `--modules`\n"
-      "flag. Note that this flag is only relevant for the Mesos\n"
-      "Containerizer.",
+      "flag. if `cgroups/all` is specified, any other cgroups related\n"
+      "isolation options (e.g., `cgroups/cpu`) will be ignored, and all\n"
+      "the local enabled cgroups subsystems on the agent host will be\n"
+      "automatically loaded by the cgroups isolator. Note that this flag\n"
+      "is only relevant for the Mesos Containerizer.",
 #ifndef __WINDOWS__
       "posix/cpu,posix/mem"
 #else


[2/6] mesos git commit: Added `cgroups/all` into CHANGELOG and upgrades.md.

Posted by gi...@apache.org.
Added `cgroups/all` into CHANGELOG and upgrades.md.

Review: https://reviews.apache.org/r/67381/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/00ce78bd
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/00ce78bd
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/00ce78bd

Branch: refs/heads/master
Commit: 00ce78bd7074c343df52a212ff77baf31d20b4c1
Parents: 3150de7
Author: Qian Zhang <zh...@gmail.com>
Authored: Mon Jun 18 23:23:56 2018 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Mon Jun 18 23:36:50 2018 -0700

----------------------------------------------------------------------
 CHANGELOG        | 6 ++++++
 docs/upgrades.md | 5 +++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/00ce78bd/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 0c45af6..0e44277 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,12 @@ Release Notes - Mesos - Version 1.7.0 (WIP)
 -------------------------------------------
 This release contains the following new features:
 
+  * [MESOS-7691] - Added a new option `cgroups/all` to the agent flag
+    `--isolation`. This allows cgroups isolator to automatically load
+    all the local enabled cgroups subsystems. If this option is specified
+    in the agent flag `--isolation` along with other cgroups related
+    options (e.g., `cgroups/cpu`), those options will be just ignored.
+
   * [MESOS-8792] - Added a new `linux/devices` isolator that automatically
     populates containers with devices that have been whitelisted with the
     `--allowed_devices` agent flag.

http://git-wip-us.apache.org/repos/asf/mesos/blob/00ce78bd/docs/upgrades.md
----------------------------------------------------------------------
diff --git a/docs/upgrades.md b/docs/upgrades.md
index 18632ed..cc8a251 100644
--- a/docs/upgrades.md
+++ b/docs/upgrades.md
@@ -49,6 +49,7 @@ We categorize the changes as follows:
   <td style="word-wrap: break-word; overflow-wrap: break-word;"><!--Mesos Core-->
     <ul style="padding-left:10px;">
       <li>A <a href="#1-7-x-linux-devices-isolator">Linux devices isolator</a></li>
+      <li>A <a href="#1-7-x-auto-load-subsystems">Automatically load local enabled cgroups subsystems</a></li>
     </ul>
   </td>
 
@@ -445,6 +446,10 @@ We categorize the changes as follows:
   has been added to toggle whether the [`network/ports`](isolators/network-ports.md)
   isolator should enforce TCP ports usage limits.
 
+<a name="1-7-x-auto-load-subsystems"></a>
+
+* A new option `cgroups/all` has been added to the agent flag `--isolation`. This allows cgroups isolator to automatically load all the local enabled cgroups subsystems. If this option is specified in the agent flag `--isolation` along with other cgroups related options (e.g., `cgroups/cpu`), those options will be just ignored.
+
 <a name="1-7-x-container-logger"></a>
 
 * `ContainerLogger` module interface has been changed. The `prepare()` method now takes `ContainerID` and `ContainerConfig` instead.


[5/6] mesos git commit: Added a test `CgroupsIsolatorTest.ROOT_CGROUPS_AutoLoadSubsystems`.

Posted by gi...@apache.org.
Added a test `CgroupsIsolatorTest.ROOT_CGROUPS_AutoLoadSubsystems`.

Review: https://reviews.apache.org/r/67358/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3150de70
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3150de70
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3150de70

Branch: refs/heads/master
Commit: 3150de7069dbb82d8a5b3e9dc993e11aa9cd2c29
Parents: b8a1c08
Author: Qian Zhang <zh...@gmail.com>
Authored: Mon Jun 18 23:23:52 2018 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Mon Jun 18 23:36:50 2018 -0700

----------------------------------------------------------------------
 .../containerizer/cgroups_isolator_tests.cpp    | 115 ++++++++++++++++++-
 1 file changed, 114 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3150de70/src/tests/containerizer/cgroups_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp b/src/tests/containerizer/cgroups_isolator_tests.cpp
index 231e958..d1028e3 100644
--- a/src/tests/containerizer/cgroups_isolator_tests.cpp
+++ b/src/tests/containerizer/cgroups_isolator_tests.cpp
@@ -39,12 +39,17 @@
 
 using mesos::internal::master::Master;
 
+using mesos::internal::slave::CGROUP_SUBSYSTEM_BLKIO_NAME;
 using mesos::internal::slave::CGROUP_SUBSYSTEM_CPU_NAME;
 using mesos::internal::slave::CGROUP_SUBSYSTEM_CPUACCT_NAME;
+using mesos::internal::slave::CGROUP_SUBSYSTEM_CPUSET_NAME;
 using mesos::internal::slave::CGROUP_SUBSYSTEM_DEVICES_NAME;
+using mesos::internal::slave::CGROUP_SUBSYSTEM_HUGETLB_NAME;
 using mesos::internal::slave::CGROUP_SUBSYSTEM_MEMORY_NAME;
 using mesos::internal::slave::CGROUP_SUBSYSTEM_NET_CLS_NAME;
+using mesos::internal::slave::CGROUP_SUBSYSTEM_NET_PRIO_NAME;
 using mesos::internal::slave::CGROUP_SUBSYSTEM_PERF_EVENT_NAME;
+using mesos::internal::slave::CGROUP_SUBSYSTEM_PIDS_NAME;
 using mesos::internal::slave::CPU_SHARES_PER_CPU_REVOCABLE;
 using mesos::internal::slave::DEFAULT_EXECUTOR_CPUS;
 
@@ -847,7 +852,7 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_NET_CLS_Isolate)
   AWAIT_READY(statusRunning);
   ASSERT_EQ(TASK_RUNNING, statusRunning->state());
 
-  // Task is ready.  Make sure there is exactly 1 container in the hashset.
+  // Task is ready. Make sure there is exactly 1 container in the hashset.
   Future<hashset<ContainerID>> containers = containerizer->containers();
   AWAIT_READY(containers);
   ASSERT_EQ(1u, containers->size());
@@ -1790,6 +1795,114 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_BlkioUsage)
   driver.join();
 }
 
+
+// This test verifies all the local enabled cgroups subsystems
+// can be automatically loaded by the cgroup isolator.
+TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_AutoLoadSubsystems)
+{
+  Try<Owned<cluster::Master>> master = StartMaster();
+  ASSERT_SOME(master);
+
+  slave::Flags flags = CreateSlaveFlags();
+  flags.isolation = "cgroups/all";
+
+  Fetcher fetcher(flags);
+
+  Try<MesosContainerizer*> _containerizer =
+    MesosContainerizer::create(flags, true, &fetcher);
+
+  ASSERT_SOME(_containerizer);
+
+  Owned<MesosContainerizer> containerizer(_containerizer.get());
+
+  Owned<MasterDetector> detector = master.get()->createDetector();
+
+  Try<Owned<cluster::Slave>> slave = StartSlave(
+      detector.get(),
+      containerizer.get());
+
+  ASSERT_SOME(slave);
+
+  MockScheduler sched;
+
+  MesosSchedulerDriver driver(
+      &sched,
+      DEFAULT_FRAMEWORK_INFO,
+      master.get()->pid,
+      DEFAULT_CREDENTIAL);
+
+  EXPECT_CALL(sched, registered(&driver, _, _));
+
+  Future<vector<Offer>> offers;
+  EXPECT_CALL(sched, resourceOffers(&driver, _))
+    .WillOnce(FutureArg<1>(&offers))
+    .WillRepeatedly(Return()); // Ignore subsequent offers.
+
+  driver.start();
+
+  AWAIT_READY(offers);
+  ASSERT_FALSE(offers->empty());
+
+  TaskInfo task = createTask(offers.get()[0], "sleep 1000");
+
+  Future<TaskStatus> statusStarting;
+  Future<TaskStatus> statusRunning;
+  EXPECT_CALL(sched, statusUpdate(_, _))
+    .WillOnce(FutureArg<1>(&statusStarting))
+    .WillOnce(FutureArg<1>(&statusRunning));
+
+  driver.launchTasks(offers.get()[0].id(), {task});
+
+  // Capture the update to verify that the task has been launched.
+  AWAIT_READY(statusStarting);
+  ASSERT_EQ(TASK_STARTING, statusStarting->state());
+
+  AWAIT_READY(statusRunning);
+  ASSERT_EQ(TASK_RUNNING, statusRunning->state());
+
+  // Task is ready. Make sure there is exactly 1 container in the hashset.
+  Future<hashset<ContainerID>> containers = containerizer->containers();
+  AWAIT_READY(containers);
+  ASSERT_EQ(1u, containers->size());
+
+  const ContainerID& containerId = *(containers->begin());
+
+  Try<set<string>> enabledSubsystems = cgroups::subsystems();
+  ASSERT_SOME(enabledSubsystems);
+
+  set<string> supportedSubsystems = {
+    CGROUP_SUBSYSTEM_BLKIO_NAME,
+    CGROUP_SUBSYSTEM_CPU_NAME,
+    CGROUP_SUBSYSTEM_CPUACCT_NAME,
+    CGROUP_SUBSYSTEM_CPUSET_NAME,
+    CGROUP_SUBSYSTEM_DEVICES_NAME,
+    CGROUP_SUBSYSTEM_HUGETLB_NAME,
+    CGROUP_SUBSYSTEM_MEMORY_NAME,
+    CGROUP_SUBSYSTEM_NET_CLS_NAME,
+    CGROUP_SUBSYSTEM_NET_PRIO_NAME,
+    CGROUP_SUBSYSTEM_PERF_EVENT_NAME,
+    CGROUP_SUBSYSTEM_PIDS_NAME,
+  };
+
+  // Check cgroups for all the local enabled subsystems
+  // have been created for the container.
+  foreach (const string& subsystem, enabledSubsystems.get()) {
+    if (supportedSubsystems.count(subsystem) == 0) {
+      continue;
+    }
+
+    Result<string> hierarchy = cgroups::hierarchy(subsystem);
+    ASSERT_SOME(hierarchy);
+
+    string cgroup = path::join(flags.cgroups_root, containerId.value());
+
+    ASSERT_TRUE(os::exists(path::join(hierarchy.get(), cgroup)));
+  }
+
+  driver.stop();
+  driver.join();
+}
+
 } // namespace tests {
 } // namespace internal {
 } // namespace mesos {


[3/6] mesos git commit: Automatically loaded all the local enabled cgroups subsystems.

Posted by gi...@apache.org.
Automatically loaded all the local enabled cgroups subsystems.

When `cgroups/all` is specified in the agent flag `--isolation`, we
will automatically load all the local enabled cgroups subsystems in
the cgroups isolator.

Review: https://reviews.apache.org/r/67343/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b8a1c083
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b8a1c083
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b8a1c083

Branch: refs/heads/master
Commit: b8a1c083083994743d224c33155761cc82a20f8b
Parents: 11f1a7c
Author: Qian Zhang <zh...@gmail.com>
Authored: Mon Jun 18 23:23:47 2018 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Mon Jun 18 23:36:50 2018 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp |   1 +
 .../mesos/isolators/cgroups/cgroups.cpp         | 104 +++++++++++++------
 2 files changed, 75 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b8a1c083/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 7b3b0d3..98129d0 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -382,6 +382,7 @@ Try<MesosContainerizer*> MesosContainerizer::create(
 #endif // __WINDOWS__
 
 #ifdef __linux__
+    {"cgroups/all", &CgroupsIsolatorProcess::create},
     {"cgroups/blkio", &CgroupsIsolatorProcess::create},
     {"cgroups/cpu", &CgroupsIsolatorProcess::create},
     {"cgroups/cpuset", &CgroupsIsolatorProcess::create},

http://git-wip-us.apache.org/repos/asf/mesos/blob/b8a1c083/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
index 215e324..6d14672 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
@@ -14,6 +14,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include <set>
 #include <vector>
 
 #include <process/collect.hpp>
@@ -46,6 +47,7 @@ using process::Future;
 using process::Owned;
 using process::PID;
 
+using std::set;
 using std::string;
 using std::vector;
 
@@ -89,52 +91,94 @@ Try<Isolator*> CgroupsIsolatorProcess::create(const Flags& flags)
     {"pids", CGROUP_SUBSYSTEM_PIDS_NAME},
   };
 
-  foreach (string isolator, strings::tokenize(flags.isolation, ",")) {
-    if (!strings::startsWith(isolator, "cgroups/")) {
-      // Skip when the isolator is not related to cgroups.
-      continue;
-    }
+  // All the subsystems currently supported by Mesos.
+  set<string> supportedSubsystems;
+  foreachvalue (const string& subsystemName, isolatorMap) {
+    supportedSubsystems.insert(subsystemName);
+  }
 
-    isolator = strings::remove(isolator, "cgroups/", strings::Mode::PREFIX);
+  // The subsystems to be loaded.
+  set<string> subsystemSet;
 
-    if (!isolatorMap.contains(isolator)) {
+  if (strings::contains(flags.isolation, "cgroups/all")) {
+    Try<set<string>> enabledSubsystems = cgroups::subsystems();
+    if (enabledSubsystems.isError()) {
       return Error(
-          "Unknown or unsupported isolator 'cgroups/" + isolator + "'");
+          "Failed to get the enabled subsystems: " + enabledSubsystems.error());
     }
 
-    // A cgroups isolator name may map to multiple subsystems. We need to
-    // convert the isolator name to its associated subsystems.
-    foreach (const string& subsystemName, isolatorMap.get(isolator)) {
-      if (hierarchies.contains(subsystemName)) {
-        // Skip when the subsystem exists.
+    foreach (const string& subsystemName, enabledSubsystems.get()) {
+      if (supportedSubsystems.count(subsystemName) == 0) {
+        // Skip when the subsystem is not supported by Mesos yet.
+        LOG(WARNING) << "Cannot automatically load the subsystem '"
+                     << subsystemName << "' because it is not "
+                     << "supported by Mesos cgroups isolator yet";
         continue;
       }
 
-      // Prepare hierarchy if it does not exist.
-      Try<string> hierarchy = cgroups::prepare(
-          flags.cgroups_hierarchy,
-          subsystemName,
-          flags.cgroups_root);
+      subsystemSet.insert(subsystemName);
+    }
 
-      if (hierarchy.isError()) {
-        return Error(
-            "Failed to prepare hierarchy for the subsystem '" + subsystemName +
-            "': " + hierarchy.error());
+    if (subsystemSet.empty()) {
+      return Error("No subsystems are enabled by the kernel");
+    }
+
+    LOG(INFO) << "Automatically loading subsystems: "
+              << stringify(subsystemSet);
+  } else {
+    foreach (string isolator, strings::tokenize(flags.isolation, ",")) {
+      if (!strings::startsWith(isolator, "cgroups/")) {
+        // Skip when the isolator is not related to cgroups.
+        continue;
       }
 
-      // Create and load the subsystem.
-      Try<Owned<Subsystem>> subsystem =
-        Subsystem::create(flags, subsystemName, hierarchy.get());
+      isolator = strings::remove(isolator, "cgroups/", strings::Mode::PREFIX);
 
-      if (subsystem.isError()) {
+      if (!isolatorMap.contains(isolator)) {
         return Error(
-            "Failed to create subsystem '" + subsystemName + "': " +
-            subsystem.error());
+            "Unknown or unsupported isolator 'cgroups/" + isolator + "'");
+      }
+
+      // A cgroups isolator name may map to multiple subsystems. We need to
+      // convert the isolator name to its associated subsystems.
+      foreach (const string& subsystemName, isolatorMap.get(isolator)) {
+        subsystemSet.insert(subsystemName);
       }
+    }
+  }
 
-      subsystems.put(hierarchy.get(), subsystem.get());
-      hierarchies.put(subsystemName, hierarchy.get());
+  CHECK(!subsystemSet.empty());
+
+  foreach (const string& subsystemName, subsystemSet) {
+    if (hierarchies.contains(subsystemName)) {
+      // Skip when the subsystem exists.
+      continue;
+    }
+
+    // Prepare hierarchy if it does not exist.
+    Try<string> hierarchy = cgroups::prepare(
+        flags.cgroups_hierarchy,
+        subsystemName,
+        flags.cgroups_root);
+
+    if (hierarchy.isError()) {
+      return Error(
+          "Failed to prepare hierarchy for the subsystem '" + subsystemName +
+          "': " + hierarchy.error());
+    }
+
+    // Create and load the subsystem.
+    Try<Owned<Subsystem>> subsystem =
+      Subsystem::create(flags, subsystemName, hierarchy.get());
+
+    if (subsystem.isError()) {
+      return Error(
+          "Failed to create subsystem '" + subsystemName + "': " +
+          subsystem.error());
     }
+
+    subsystems.put(hierarchy.get(), subsystem.get());
+    hierarchies.put(subsystemName, hierarchy.get());
   }
 
   Owned<MesosIsolatorProcess> process(