You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2018/11/27 17:53:42 UTC

[mesos] branch master updated: Added the `DISCARD` blkio cgroup operation.

This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 68cf437  Added the `DISCARD` blkio cgroup operation.
68cf437 is described below

commit 68cf4372721ca71741b6d836072f432d65d102f9
Author: James Peach <jp...@apache.org>
AuthorDate: Tue Nov 27 09:08:40 2018 -0800

    Added the `DISCARD` blkio cgroup operation.
    
    The Linux 4.19 kernel added a new `Discard` operation to the blkio
    cgroup statistics. Added this new operation so that the containerizer
    won't fail to parse blkio statistics on the latest kernels.
    
    Review: https://reviews.apache.org/r/69449/
---
 include/mesos/mesos.proto                                            | 1 +
 include/mesos/v1/mesos.proto                                         | 1 +
 src/linux/cgroups.cpp                                                | 5 ++++-
 src/linux/cgroups.hpp                                                | 3 +++
 src/slave/containerizer/mesos/isolators/cgroups/subsystems/blkio.cpp | 3 +++
 5 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 06a901d..56107f4 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -3279,6 +3279,7 @@ message CgroupInfo {
       WRITE = 3;
       SYNC = 4;
       ASYNC = 5;
+      DISCARD = 6;
     }
 
     // Describes a stat value without the device descriptor part.
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 75cdb28..c6e7515 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -3272,6 +3272,7 @@ message CgroupInfo {
       WRITE = 3;
       SYNC = 4;
       ASYNC = 5;
+      DISCARD = 6;
     }
 
     // Describes a stat value without the device descriptor part.
diff --git a/src/linux/cgroups.cpp b/src/linux/cgroups.cpp
index 45dd5cf..73646c9 100644
--- a/src/linux/cgroups.cpp
+++ b/src/linux/cgroups.cpp
@@ -1804,7 +1804,8 @@ static bool isOperation(const string& s)
           s == "Read" ||
           s == "Write" ||
           s == "Sync" ||
-          s == "Async");
+          s == "Async" ||
+          s == "Discard");
 }
 
 
@@ -1820,6 +1821,8 @@ static Try<Operation> parseOperation(const string& s)
     return Operation::SYNC;
   } else if (s == "Async") {
     return Operation::ASYNC;
+  } else if (s == "Discard") {
+    return Operation::DISCARD;
   }
 
   return Error("Invalid Operation value: '" + s + "'");
diff --git a/src/linux/cgroups.hpp b/src/linux/cgroups.hpp
index f4cc2d8..19c0092 100644
--- a/src/linux/cgroups.hpp
+++ b/src/linux/cgroups.hpp
@@ -461,6 +461,7 @@ enum class Operation {
   WRITE,
   SYNC,
   ASYNC,
+  DISCARD,
 };
 
 
@@ -646,6 +647,8 @@ inline std::ostream& operator<<(std::ostream& stream, const Operation op)
       return stream << "Sync";
     case Operation::ASYNC:
       return stream << "Async";
+    case Operation::DISCARD:
+      return stream << "Discard";
   }
 
   UNREACHABLE();
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/blkio.cpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/blkio.cpp
index fbf1fed..19afed9 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/blkio.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/blkio.cpp
@@ -85,6 +85,9 @@ static void setValue(
       case cgroups::blkio::Operation::ASYNC:
         value->set_op(CgroupInfo::Blkio::ASYNC);
         break;
+      case cgroups::blkio::Operation::DISCARD:
+        value->set_op(CgroupInfo::Blkio::DISCARD);
+        break;
     }
   }