diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-05-12 16:16:42 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-05-12 16:16:42 +0200 |
commit | ee5f4a60881631f1b98361e54db6579e3241ca48 (patch) | |
tree | f2f8098db4793874924858ea29aedc13fce16983 /vespalib | |
parent | 4bb82cc75fe70611b2a8c7c3d16165e1d85355e4 (diff) |
Extend class comments.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h | 23 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/resource_limits.h | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h b/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h index 04fc0384c1a..72333195545 100644 --- a/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h +++ b/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h @@ -11,7 +11,28 @@ namespace vespalib { /* - * Class for getting cgroup resource limits. + * Class for getting cgroup resource limits (memory and cpu resources). + * + * Cgroups version 1 and version 2 are handled, but a mix of cgroups version 1 + * and cgroups version 2 is not handled. + * + * Systemd resource control unit settings applied to cgroups (cf. + * systemd.resource-control(5) manual page on Linux) and + * container resource limit (set by e.g. docker and podman) applied to cgroups + * should be reflected in the sampled resource limits. + * + * The --cpus and --memory options for docker/podman create are reflected + * in cgroup limits that are sampled, but the cgroup limit affected by the + * --cpuset-cpus option is not yet sampled. + * + * For cgroups version 1, "memory.limit_in_bytes", "cpu.cfs_quota_us" and + * "cpu.cfs_period_us" are sampled. + * + * For cgroups version 2, "memory.max" and "cpu.max" are sampled. + * + * This is intended to be used by vespa-proton-bin running on the host + * or in a container, as a systemd service or not, with cgroups + * version 1 or cgroups version 2. */ class CGroupResourceLimits { std::optional<uint64_t> _memory_limit; diff --git a/vespalib/src/vespa/vespalib/util/resource_limits.h b/vespalib/src/vespa/vespalib/util/resource_limits.h index 7255cef9df5..8e1c7a7c34f 100644 --- a/vespalib/src/vespa/vespalib/util/resource_limits.h +++ b/vespalib/src/vespa/vespalib/util/resource_limits.h @@ -7,7 +7,11 @@ namespace vespalib { /* - * Class for getting resource limits. + * Class for getting resource limits. Memory limit is first sampled by + * using sysconf to get page size and number of physical pages. + * Cpu limit is first sampled by calling std::thread::hardware_concurrency(). + * Both limits can be adjusted downwards by applying some of the cgroup limits + * for the current process, cf. CGroupResourceLimits). */ class ResourceLimits { uint64_t _memory; |