diff options
author | Aaron Lu <aaron.lu@intel.com> | 2018-04-02 15:44:45 +0800 |
---|---|---|
committer | Fengguang Wu <fengguang.wu@intel.com> | 2018-04-02 15:44:45 +0800 |
commit | f11b2901356f3c15d917059e54184e546f342177 (patch) | |
tree | 5480742e8bf7b64c266a54d7bab884d8974393cb | |
parent | 97d93f1e3f4099e2615561add306537cc5d55ca4 (diff) | |
download | vm-scalability-f11b2901356f3c15d917059e54184e546f342177.tar.gz |
hw_vars: limit pagetable to half available memory
We used to use half memory to limit page table, this is OK for setup
that doesn't have other unreclaimable memory consumptions, but consider
if rootfs is hosted on ram and there is no swap, the rootfs consumed
memory is also unreclaimable and can be huge. That can cause some test
OOM.
Solve this by using MemAvailable from /proc/meminfo instead of the
previous MemTotal. This also impacts PTE_LIMIT.
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
-rwxr-xr-x | hw_vars | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -137,15 +137,16 @@ while read key val unit; do done < /proc/meminfo mem=$((MemTotal << 10)) +mem_avail=$((MemAvailable << 10)) hugepagesize=$((Hugepagesize << 10)) ROTATE_BYTES=$((1<<42)) -# prevent OOM: limit pagetable pages to half memory -[ "$ROTATE_BYTES" -gt $(( mem << 8 )) ] && ROTATE_BYTES=$(( mem << 8 )) # Documentation/x86/x86_64/mm.txt # 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm AS_LIMIT=$((1<<46)) -PTE_LIMIT=$((mem << 8)) +PTE_LIMIT=$((mem_avail << 8)) +# prevent OOM: limit pagetable pages to half available memory +[ "$ROTATE_BYTES" -gt $PTE_LIMIT ] && ROTATE_BYTES=$PTE_LIMIT |