4

I came across the following parameter in kernel settings (in sysctl):

vm.min_free_kbytes

This is the amount of free memory (RAM) that's always free no matter what. In my case, I have only 1 GiB of RAM, and this parameter was set to about 64MiB. I thought that's pretty high, so I lowered it to 8MiB so far. I don't know if I can lower it any further, or if lowering it to 8MiB can cause any troubles, so the question is what would happen if the amount of the free memory was too low? Can I safely lower the value to 1MiB?

1
  • Have you lowered the value? How is it working? Is there any problems?
    – John
    Jun 17, 2020 at 3:05

1 Answer 1

8

Should be safe but can't guarentee it. From kernel docs:

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.

Essentially if you set it to low you'll have problems with memory allocation.

2
  • 1
    PF_MEMALLOC is used in low memory situations if kernel processes that try to free e.g. disk caches need some work memory. If the kernel cannot get memory in that case the whole system may hang. If you're lucky, you may get visible kernel panic or something in syslog. Otherwise, you have set the limit too low if system just hangs with no explanation. Note that this only makes difference when RAM is almost full so you need to test with highest RAM comsumption you're going to expect. Dec 17, 2017 at 12:08
  • @Livinglifeback What is "linux VM" short for?
    – John
    Jun 17, 2020 at 3:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .