JDK-8230848 : OSContainer: Refactor container detection code
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Withdrawn
  • OS: linux
  • CPU: generic
  • Submitted: 2019-09-11
  • Updated: 2019-11-07
  • Resolved: 2019-11-07
Description
Currently some OSContainer functions use direct CGroup V1 implementation details. This should be made more agnostic so as to accommodate for a future CGroup V2-based implementation (See JDK-8230305).

The proposal is dispatch to cgroup version agnostic implementations for the following functions:

  static const char * container_type();
  static jlong memory_limit_in_bytes();
  static jlong memory_and_swap_limit_in_bytes();
  static jlong memory_soft_limit_in_bytes();
  static jlong memory_usage_in_bytes();
  static jlong memory_max_usage_in_bytes();
  static char * cpu_cpuset_cpus();
  static char * cpu_cpuset_memory_nodes();
  static int cpu_quota();
  static int cpu_period();
  static int cpu_shares();

This would allow for support for cgroup v2 without actually changing OSContainer code for those functions.
Comments
This is going to get a pain to maintain. JDK-8230305 will have all of it folded into one.
07-11-2019

Prototype webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8230848/04/webrev/
14-10-2019