aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2018-04-02 11:26:40 +0800
committerFengguang Wu <fengguang.wu@intel.com>2018-04-02 12:36:58 +0800
commit97d93f1e3f4099e2615561add306537cc5d55ca4 (patch)
treefe15f88d3cd1d24a03688f7e379f0202fd9297f3
parent302e9c65c67ce4c1b57c34623125dca7eb02bf9e (diff)
downloadvm-scalability-97d93f1e3f4099e2615561add306537cc5d55ca4.tar.gz
case-small-allocs: restrict slab usage
commit c079cd0e70ad("small-allocs: restrict vm_area_struct slab memory usage") fixed the excessive slab size problem but didn't handle -mt case. This commit fixes the same problem for -mt case. We may want to tune the limited size in future, to avoid changing two files, make the restrict_slab_size part a common file and include it for both test cases. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
-rwxr-xr-xcase-small-allocs20
-rwxr-xr-xcase-small-allocs-mt7
-rw-r--r--small-allocs-common21
3 files changed, 24 insertions, 24 deletions
diff --git a/case-small-allocs b/case-small-allocs
index 73e4387..688c17c 100755
--- a/case-small-allocs
+++ b/case-small-allocs
@@ -1,23 +1,5 @@
#!/bin/sh
-# flush memory and
-# create lots of small continuous VMAs
-
-. ./hw_vars
-
-# 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
+. ./case-small-allocs-common
$USEMEM -n $nr_task --readonly --unit $unit_size $((size / nr_task))
diff --git a/case-small-allocs-mt b/case-small-allocs-mt
index 634666e..e3d96a7 100755
--- a/case-small-allocs-mt
+++ b/case-small-allocs-mt
@@ -1,8 +1,5 @@
#!/bin/sh
-# flush memory and
-# create lots of small continuous VMAs
+. ./case-small-allocs-common
-. ./hw_vars
-
-$USEMEM -t $nr_task --readonly --unit $((10 * pagesize)) $((ROTATE_BYTES / nr_task))
+$USEMEM -t $nr_task --readonly --unit $((10 * pagesize)) $((size / nr_task))
diff --git a/small-allocs-common b/small-allocs-common
new file mode 100644
index 0000000..80452bc
--- /dev/null
+++ b/small-allocs-common
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# flush memory and
+# create lots of small continuous VMAs
+
+. ./hw_vars
+
+# 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