RFR: 8170888: [linux] Experimental support for cgroup memory limits in container (ie Docker) environments

Kim Barrett kim.barrett at oracle.com
Mon Dec 12 07:41:40 UTC 2016


> On Dec 10, 2016, at 5:14 PM, David Holmes <david.holmes at oracle.com> wrote:
> 
> Updated webrev at:
> 
> http://cr.openjdk.java.net/~dholmes/8170888/webrev.v2/
> 
> Now checks fscanf ret code. Plus fixed 'else' formatting.
> 
> Thanks,
> David
> -----
> 
> +       int ret = fscanf(fp, JULONG_FORMAT, &cgroup_max);
> +       if (ret == 1 && cgroup_max > 0) {
> +         // If unlimited, cgroup_max will be a very large, but unspecified
> +         // value, so use initial phys_mem as a limit
> +         log_info(gc, heap)("Setting phys_mem to the min of cgroup limit ("
> +                            JULONG_FORMAT "MB) and initial phys_mem ("
> +                            JULONG_FORMAT "MB)", cgroup_max/M, phys_mem/M);
> +         phys_mem = MIN2(cgroup_max, phys_mem);
> +       } else {
> +         warning("Unable to read/parse cgroup memory limit from %s: %s",
> +                 lim_file, errno != 0 ? strerror(errno) : "unknown error");
> +       }
> 

Looks good.



More information about the hotspot-dev mailing list