blob: eb72aa38d1d53ba9debf59511b144a365fc71091 [file] [log] [blame]
Tim Windelschmidtd9f1f1e2023-10-31 15:44:35 +01001package main
2
3import (
4 "context"
5 "strconv"
6
7 "source.monogon.dev/metropolis/pkg/supervisor"
8 "source.monogon.dev/metropolis/pkg/sysctl"
9)
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}