blob: 01b576c0c704d8736ce38837015ca9a7d99c4209 [file] [log] [blame]
Tim Windelschmidtd9f1f1e2023-10-31 15:44:35 +01001package main
2
3import (
4 "context"
5 "strconv"
6
Tim Windelschmidt9f21f532024-05-07 15:14:20 +02007 "source.monogon.dev/osbase/supervisor"
8 "source.monogon.dev/osbase/sysctl"
Tim Windelschmidtd9f1f1e2023-10-31 15:44:35 +01009)
10
11func nodeSysctls(ctx context.Context) error {
12 const vmMaxMapCount = 2<<30 - 1
13 options := sysctl.Options{
14 // We increase the max mmap count to nearly the maximum, as it gets
15 // accounted by the cgroup memory limit.
16 "vm.max_map_count": strconv.Itoa(vmMaxMapCount),
17 }
18
19 if err := options.Apply(); err != nil {
20 return err
21 }
22
23 supervisor.Signal(ctx, supervisor.SignalHealthy)
24 supervisor.Signal(ctx, supervisor.SignalDone)
25 return nil
26}