Increase min_free_kbytes to 256M for storage to avoid OOM issue

Help to prevent the OOM issue that it failed to allocate memory
with error message 'page allocation failure: order:2, mode:0x104020'

As the min_free_kbytes in the linux documentation shows:
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.

Keeping more memory free in those zones means that the os itself is
less likely to run out of memory during high memory pressure and high
allocation events.

Based on the issue occurs on the storage node so far, we only update
the value for the storage node.

Closes-Bug: #1924209

Change-Id: Iae2e5a0787f69c62ba5da53663371fd2be148e15
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
This commit is contained in:
Zhixiong Chi 2021-04-14 23:28:03 -04:00
parent f0818c79a3
commit 94ec35ff2d
1 changed files with 15 additions and 5 deletions

View File

@ -10,11 +10,6 @@ class platform::sysctl
$ip_version = $::platform::network::mgmt::params::subnet_version
# Increase min_free_kbytes to 128 MiB from 88 MiB, helps prevent OOM
sysctl::value { 'vm.min_free_kbytes':
value => '131072'
}
# Set sched_nr_migrate to standard linux default
sysctl::value { 'kernel.sched_nr_migrate':
value => '8',
@ -119,6 +114,11 @@ class platform::sysctl::controller
include ::platform::sysctl
include ::platform::sysctl::controller::reserve_ports
# Increase min_free_kbytes to 128 MiB from 88 MiB, helps prevent OOM
sysctl::value { 'vm.min_free_kbytes':
value => '131072'
}
# Engineer VM page cache tunables to prevent significant IO delays that may
# occur if we flush a buildup of dirty pages. Engineer VM settings to make
# writebacks more regular. Note that Linux default proportion of page cache that
@ -164,11 +164,21 @@ class platform::sysctl::controller
class platform::sysctl::compute {
include ::platform::sysctl
# Increase min_free_kbytes to 128 MiB from 88 MiB, helps prevent OOM
sysctl::value { 'vm.min_free_kbytes':
value => '131072'
}
}
class platform::sysctl::storage {
include ::platform::sysctl
# Increase min_free_kbytes to 256 MiB for storage node, helps prevent OOM
sysctl::value { 'vm.min_free_kbytes':
value => '262144'
}
}