blob: 2ff874ee60210c9a0b4e15650aec44df8f8765c7 [file] [log] [blame]
Tim Windelschmidt6d33a432025-02-04 14:34:25 +01001// Copyright The Monogon Project Authors.
2// SPDX-License-Identifier: Apache-2.0
3
Tim Windelschmidtd9f1f1e2023-10-31 15:44:35 +01004package main
5
6import (
7 "context"
8 "strconv"
9
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020010 "source.monogon.dev/osbase/supervisor"
11 "source.monogon.dev/osbase/sysctl"
Tim Windelschmidtd9f1f1e2023-10-31 15:44:35 +010012)
13
14func nodeSysctls(ctx context.Context) error {
15 const vmMaxMapCount = 2<<30 - 1
16 options := sysctl.Options{
17 // We increase the max mmap count to nearly the maximum, as it gets
18 // accounted by the cgroup memory limit.
19 "vm.max_map_count": strconv.Itoa(vmMaxMapCount),
20 }
21
22 if err := options.Apply(); err != nil {
23 return err
24 }
25
26 supervisor.Signal(ctx, supervisor.SignalHealthy)
27 supervisor.Signal(ctx, supervisor.SignalDone)
28 return nil
29}