case-truncate-seq: truncate sequentially
Mel Gorman suggested LKP to cover a case where sparsefiles are removed
sequentially so add a case based on case-truncate, which did the remove
concurrently.
In the meantime, this script will also report faultin time.
Note the example script provided by Mel in the below link has a 'sync'
after reading of the sparsefile and before removing of it. I failed to
understand the intent of the 'sync' so I omitted.
LINK: https://lore.kernel.org/linux-mm/20220217093113.GU3366@techsingularity.net/
Suggested-by: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
diff --git a/case-truncate-seq b/case-truncate-seq
new file mode 100755
index 0000000..efa3a90
--- /dev/null
+++ b/case-truncate-seq
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# step 1) fill $mem with $nr_task files
+# step 2) truncate the files sequentially
+
+. ./hw_vars
+
+t0=$(date +%s.%N)
+for i in `seq $nr_task`
+do
+ create_sparse_file $SPARSE_FILE-$i $((mem / nr_task))
+ cat $SPARSE_FILE-$i > /dev/null
+done
+t1=$(date +%s.%N)
+echo $mem bytes faulted in $t1-$t0 seconds
+
+t0=$(date +%s.%N)
+rm $SPARSE_FILE-*
+t1=$(date +%s.%N)
+
+echo $mem bytes truncated in $t1-$t0 seconds