< prev index next >

src/hotspot/os/linux/cgroupSubsystem_linux.hpp

Print this page
@  rev 56576 : 8230305: Cgroups v2: Container awareness
|  Summary: Implement Cgroups v2 container awareness in hotspot
|  Reviewed-by: bobv
o  rev 56575 : 8230848: OSContainer: Refactor container detection code
|  Summary: Move cgroups v1 implementation details out of osContainer_linux.cpp
~  Reviewed-by: bobv


 164                                                                           \
 165   log_trace(os, container)(logstring, variable);                          \
 166 }
 167 
 168 #define GET_CONTAINER_INFO_LINE(return_type, controller, filename,        \
 169                            matchline, logstring, scan_fmt, variable)      \
 170   return_type variable;                                                   \
 171 {                                                                         \
 172   int err;                                                                \
 173   err = subsystem_file_line_contents(controller,                          \
 174                                 filename,                                 \
 175                                 matchline,                                \
 176                                 scan_fmt,                                 \
 177                                 &variable);                               \
 178   if (err != 0)                                                           \
 179     return (return_type) OSCONTAINER_ERROR;                               \
 180                                                                           \
 181   log_trace(os, container)(logstring, variable);                          \
 182 }
 183 



 184 class CgroupSubsystem: CHeapObj<mtInternal> {
 185   friend class CgroupSubsystemFactory;
 186   public:
 187     int active_processor_count(int physical_proc_count);
 188 
 189     virtual int cpu_quota();
 190     virtual int cpu_period();
 191     virtual int cpu_shares();
 192     virtual jlong memory_usage_in_bytes();
 193     virtual jlong memory_and_swap_limit_in_bytes();
 194     virtual jlong memory_soft_limit_in_bytes();
 195     virtual jlong memory_max_usage_in_bytes();
 196     virtual char * cpu_cpuset_cpus();
 197     virtual char * cpu_cpuset_memory_nodes();
 198     virtual jlong memory_limit_in_bytes();
 199     virtual const char * container_type();
 200 };
 201 
 202 class CgroupSubsystemFactory: AllStatic {
 203   public:
 204     static CgroupSubsystem* create();
 205 };














 206 
 207 #endif // CGROUP_SUBSYSTEM_LINUX_HPP


 164                                                                           \
 165   log_trace(os, container)(logstring, variable);                          \
 166 }
 167 
 168 #define GET_CONTAINER_INFO_LINE(return_type, controller, filename,        \
 169                            matchline, logstring, scan_fmt, variable)      \
 170   return_type variable;                                                   \
 171 {                                                                         \
 172   int err;                                                                \
 173   err = subsystem_file_line_contents(controller,                          \
 174                                 filename,                                 \
 175                                 matchline,                                \
 176                                 scan_fmt,                                 \
 177                                 &variable);                               \
 178   if (err != 0)                                                           \
 179     return (return_type) OSCONTAINER_ERROR;                               \
 180                                                                           \
 181   log_trace(os, container)(logstring, variable);                          \
 182 }
 183 
 184 // Four controllers: cpu, cpuset, cpuacct, memory
 185 #define CG_INFO_LENGTH 4
 186 
 187 class CgroupSubsystem: CHeapObj<mtInternal> {
 188   friend class CgroupSubsystemFactory;
 189   public:
 190     int active_processor_count(int physical_proc_count);
 191 
 192     virtual int cpu_quota();
 193     virtual int cpu_period();
 194     virtual int cpu_shares();
 195     virtual jlong memory_usage_in_bytes();
 196     virtual jlong memory_and_swap_limit_in_bytes();
 197     virtual jlong memory_soft_limit_in_bytes();
 198     virtual jlong memory_max_usage_in_bytes();
 199     virtual char * cpu_cpuset_cpus();
 200     virtual char * cpu_cpuset_memory_nodes();
 201     virtual jlong memory_limit_in_bytes();
 202     virtual const char * container_type();
 203 };
 204 
 205 class CgroupSubsystemFactory: AllStatic {
 206   public:
 207     static CgroupSubsystem* create();
 208 };
 209 
 210 // Class representing info in /proc/self/cgroup.
 211 // See man 7 cgroups
 212 class CgroupInfo : public StackObj {
 213   friend class CgroupSubsystemFactory;
 214 
 215   private:
 216   char* _name;
 217   int _hierarchy_id;
 218   bool _enabled;
 219   char* _cgroup_path;
 220 
 221 };
 222 
 223 
 224 #endif // CGROUP_SUBSYSTEM_LINUX_HPP
< prev index next >