사용 가능한 메모리 양(vm.min_free_kbytes)이 너무 적으면 어떻게 되나요?

사용 가능한 메모리 양(vm.min_free_kbytes)이 너무 적으면 어떻게 되나요?

커널 설정(sysctl)에서 다음 매개변수를 발견했습니다.

vm.min_free_kbytes

이는 무슨 일이 있어도 항상 사용할 수 있는 여유 메모리(RAM)의 양입니다. 제 경우에는 RAM이 1GiB밖에 없었고 이 매개변수는 약 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.

기본적으로 낮은 값으로 설정하면 메모리 할당 문제가 발생합니다.

관련 정보