我在内核设置(在 sysctl 中)中遇到了以下参数:
vm.min_free_kbytes
这是无论如何都始终可用的可用内存 (RAM) 量。就我而言,我只有 1 GiB 的 RAM,并且此参数设置为大约 64MiB。我认为这相当高,所以到目前为止我将其降低到 8MiB。我不知道是否可以进一步降低它,或者降低到 8MiB 是否会引起任何麻烦,所以问题是如果可用内存量太低会发生什么?我可以安全地将值降低到 1MiB 吗?
答案1
应该是安全的,但不能保证。来自内核文档:
min_free_kbytes:
This is used to force the Linux VM to keep a minimum number
of kilobytes free. The VM uses this number to compute a
watermark[WMARK_MIN] value for each lowmem zone in the system.
Each lowmem zone gets a number of reserved free pages based
proportionally on its size.
Some minimal amount of memory is needed to satisfy PF_MEMALLOC
allocations; if you set this to lower than 1024KB, your system will
become subtly broken, and prone to deadlock under high loads.
Setting this too high will OOM your machine instantly.
本质上,如果将其设置为低值,则会出现内存分配问题。