GoToSocial/vendor/github.com/cilium/ebpf
Daniele Sluijters acc333c40b
[feature] Inherit resource limits from cgroups (#1336)
When GTS is running in a container runtime which has configured CPU or
memory limits or under an init system that uses cgroups to impose CPU
and memory limits the values the Go runtime sees for GOMAXPROCS and
GOMEMLIMIT are still based on the host resources, not the cgroup.

At least for the throttling middlewares which use GOMAXPROCS to
configure their queue size, this can result in GTS running with values
too big compared to the resources that will actuall be available to it.

This introduces 2 dependencies which can pick up resource contraints
from the current cgroup and tune the Go runtime accordingly. This should
result in the different queues being appropriately sized and in general
more predictable performance. These dependencies are a no-op on
non-Linux systems or if running in a cgroup that doesn't set a limit on
CPU or memory.

The automatic tuning of GOMEMLIMIT can be disabled by either explicitly
setting GOMEMLIMIT yourself or by setting AUTOMEMLIMIT=off. The
automatic tuning of GOMAXPROCS can similarly be counteracted by setting
GOMAXPROCS yourself.
2023-01-17 20:59:04 +00:00
..
asm [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
internal [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
link [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
.clang-format [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
.gitignore [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
ARCHITECTURE.md [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
CODE_OF_CONDUCT.md [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
collection.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
CONTRIBUTING.md [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
doc.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
elf_reader_fuzz.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
elf_reader.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
info.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
LICENSE [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
linker.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
Makefile [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
map.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
marshalers.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
pinning.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
prog.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
README.md [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
run-tests.sh [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
syscalls.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
types_string.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00
types.go [feature] Inherit resource limits from cgroups (#1336) 2023-01-17 20:59:04 +00:00

eBPF

PkgGoDev

eBPF is a pure Go library that provides utilities for loading, compiling, and debugging eBPF programs. It has minimal external dependencies and is intended to be used in long running processes.

  • asm contains a basic assembler
  • link allows attaching eBPF to various hooks
  • perf allows reading from a PERF_EVENT_ARRAY
  • cmd/bpf2go allows embedding eBPF in Go

The library is maintained by Cloudflare and Cilium. Feel free to join the #libbpf-go channel on Slack.

Current status

The package is production ready, but the API is explicitly unstable right now. Expect to update your code if you want to follow along.

Requirements

  • A version of Go that is supported by upstream
  • Linux 4.9, 4.19 or 5.4 (versions in-between should work, but are not tested)

Useful resources

Regenerating Testdata

Run make in the root of this repository to rebuild testdata in all subpackages. This requires Docker, as it relies on a standardized build environment to keep the build output stable.

The toolchain image build files are kept in testdata/docker/.

License

MIT