mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 22:37:14 +08:00
39d4c8d5f9
I have noticed that libct/cg/fs allocates 8K during init on every runc execution: > init github.com/opencontainers/runc/libcontainer/cgroups/fs @1.5 ms, 0.028 ms clock, 8512 bytes, 13 allocs Apparently this is caused by global HugePageSizes variable init, which is only used from GetStats (i.e. it is never used by runc itself). Remove it, and use HugePageSizes() directly instead. Make it init-once, so that GetStats (which, I guess, is periodically called by kubernetes) does not re-read huge page sizes over and over. This also removes 12 allocs and 8K from libct/cg/fs init section: > $ time GODEBUG=inittrace=1 ./runc --help 2>&1 | grep cgroups/fs > init github.com/opencontainers/runc/libcontainer/cgroups/fs @1.5 ms, 0.003 ms clock, 16 bytes, 1 allocs Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>