aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2018-04-02 15:44:45 +0800
committerFengguang Wu <fengguang.wu@intel.com>2018-04-02 15:44:45 +0800
commitf11b2901356f3c15d917059e54184e546f342177 (patch)
tree5480742e8bf7b64c266a54d7bab884d8974393cb
parent97d93f1e3f4099e2615561add306537cc5d55ca4 (diff)
downloadvm-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-xhw_vars7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw_vars b/hw_vars
index 2d8aeb5..1560e76 100755
--- a/hw_vars
+++ b/hw_vars
@@ -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