Fix cgroup memory limit detection for inherited limits (#1933)