[chore]: Bump github.com/KimMachineGun/automemlimit from 0.3.0 to 0.4.0 (#2440)

Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.3.0 to 0.4.0.
- [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: github.com/KimMachineGun/automemlimit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2023-12-11 10:35:15 +00:00
committed by GitHub
parent 9b03840b42
commit cd1611362f
8 changed files with 63 additions and 32 deletions

View File

@ -21,7 +21,7 @@ func FromCgroup() (uint64, error) {
case cgroups.Legacy:
return FromCgroupV1()
case cgroups.Hybrid:
return fromCgroupHybrid()
return FromCgroupHybrid()
case cgroups.Unified:
return FromCgroupV2()
}
@ -49,10 +49,9 @@ func FromCgroupV1() (uint64, error) {
return 0, ErrNoLimit
}
// fromCgroupHybrid returns the memory limit from the cgroup v1 or v2.
// FromCgroupHybrid returns the memory limit from the cgroup v1 or v2.
// It checks the cgroup v2 first, and if it fails, it falls back to cgroup v1.
// TODO: make this function public in the next minor version.
func fromCgroupHybrid() (uint64, error) {
func FromCgroupHybrid() (uint64, error) {
limit, err := fromCgroupV2(filepath.Join(cgroupMountPoint, "unified"))
if err == nil {
return limit, nil