[CRIU] [PATCH 1/3] zdtm.sh: add ability to use a freezer cgroup
Andrey Vagin
avagin at openvz.org
Mon Aug 3 19:18:22 PDT 2015
It allows to freeze processes faster
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm.sh | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 9797d2b..b2ad9a2 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -373,6 +373,7 @@ BATCH_TEST=0
SPECIFIED_NAME_USED=0
START_FROM="."
RESTORE_SIBLING=""
+FREEZE_CGROUP=""
zdtm_sep()
{ (
@@ -565,6 +566,10 @@ start_test()
fi
(
+ if [ -n "$FREEZE_CGROUP" ]; then
+ mkdir -p $FREEZE_CGROUP
+ echo 0 > $FREEZE_CGROUP/tasks || exit 1
+ fi
# Here is no way to set FD_CLOEXEC on 3
exec 3>&-
make -C $tdir $tname.pid
@@ -575,6 +580,10 @@ start_test()
return 1
fi
+ if [ -n "$FREEZE_CGROUP" ] && [ -n "$FREEZER_STATE" ]; then
+ echo $FREEZER_STATE > $FREEZE_CGROUP/freezer.state
+ fi
+
[ -z "$PIDNS" ] || cd -
PID=`cat "$TPID"` || return 1
@@ -759,6 +768,10 @@ EOF
fi
[ -n "$snappdir" ] && cpt_args="$cpt_args --prev-images-dir=$snappdir"
fi
+ if [ -n "$FREEZE_CGROUP" ]; then
+ cpt_args="$cpt_args --freeze-cgroup $FREEZE_CGROUP --manage-cgroups"
+ rst_args="$rst_args --manage-cgroups"
+ fi
[ -n "$dump_only" ] && cpt_args="$cpt_args $POSTDUMP"
@@ -810,6 +823,13 @@ EOF
diff_maps $ddump/dump.maps $ddump/dump.maps.after || return 1
}
+ while :; do
+ echo freezer.state=`cat $FREEZE_CGROUP/freezer.state`
+ cat $FREEZE_CGROUP/freezer.state | grep -q $FREEZER_STATE && break;
+ sleep 0.1
+ done
+ echo THAWED > $FREEZE_CGROUP/freezer.state
+
rm -f ./$tdir/link_remap.*
else
# Wait while tasks are dying, otherwise PIDs would be busy.
@@ -1060,6 +1080,15 @@ while :; do
AUTO_DEDUP=1
shift
;;
+ --freeze-cgroup)
+ shift
+ FREEZE_CGROUP=$1
+ shift
+ ;;
+ --frozen)
+ FREEZER_STATE=FROZEN
+ shift
+ ;;
-g)
COMPILE_ONLY=1
shift
--
2.1.0
More information about the CRIU
mailing list