| Tim Windelschmidt | 6d33a43 | 2025-02-04 14:34:25 +0100 | [diff] [blame^] | 1 | // Copyright The Monogon Project Authors. |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| Tim Windelschmidt | d9f1f1e | 2023-10-31 15:44:35 +0100 | [diff] [blame] | 4 | package main |
| 5 | |
| 6 | import ( |
| 7 | "context" |
| 8 | "strconv" |
| 9 | |
| Tim Windelschmidt | 9f21f53 | 2024-05-07 15:14:20 +0200 | [diff] [blame] | 10 | "source.monogon.dev/osbase/supervisor" |
| 11 | "source.monogon.dev/osbase/sysctl" |
| Tim Windelschmidt | d9f1f1e | 2023-10-31 15:44:35 +0100 | [diff] [blame] | 12 | ) |
| 13 | |
| 14 | func 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 | } |