aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2016-09-21 14:35:10 +0800
committerFengguang Wu <fengguang.wu@intel.com>2016-09-21 16:29:52 +0800
commitc079cd0e70adc7c99a8bdb11a22e28feab21cde7 (patch)
tree2a02292f68b84d4006ce84793f3e78cbe19d2d9a
parentcd690069bc126d462314de487f6a56cc2e2ea0bc (diff)
downloadvm-scalability-c079cd0e70adc7c99a8bdb11a22e28feab21cde7.tar.gz
small-allocs: restrict vm_area_struct slab memory usage
For this small allocs test, a lot of vma will be allocated. Each vma will need a vm_area_struct slab object and these objects will fill up all memory and then OOM. These slabs are unreclaimable. Restrict the memory consumption by this slab to 1/3 MemTotal. Jira-link: https://jira01.devtools.intel.com/browse/OLT-1479 Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
-rwxr-xr-xcase-small-allocs17
1 files changed, 16 insertions, 1 deletions
diff --git a/case-small-allocs b/case-small-allocs
index bf4b259..73e4387 100755
--- a/case-small-allocs
+++ b/case-small-allocs
@@ -5,4 +5,19 @@
. ./hw_vars
-$USEMEM -n $nr_task --readonly --unit $((10 * pagesize)) $((ROTATE_BYTES / nr_task))
+# vm_area_struct slab could consume a hell lot of memory for this small alloc test
+# let's restrict it to 1/3 MemTotal
+slab_mem_max=$((mem/3))
+# vm_area_struct is 192 bytes, 1 page could host 21 vm_area_struct
+# below is a line from slabinfo, where it shows 1 slab has 2 pages and 42 objects in these 2 pages.
+# vm_area_struct 58264 60816 192 42 2 : tunables 0 0 0 : slabdata 1448 1448 0
+vma_nr_max=$((21*slab_mem_max/4096))
+
+size=$ROTATE_BYTES
+unit_size=$((10 * pagesize))
+while [ $((size/unit_size)) -gt $vma_nr_max ]
+do
+ size=$((size>>1))
+done
+
+$USEMEM -n $nr_task --readonly --unit $unit_size $((size / nr_task))