[CRIU] [PATCH 2/2] zdtm/maps007: limit delta betwen parent and child from both sides
Andrey Vagin
avagin at openvz.org
Tue Feb 25 03:11:18 PST 2014
Currenty a parent can go far away from child and we will need to wait
too long for checking results.
This pach limits delta to [MIN_DELTA, 2 * MIN_DELTA].
Thi patch should fix current errors for the CRIU-iter job in Jenkins.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm/live/transition/maps007.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/test/zdtm/live/transition/maps007.c b/test/zdtm/live/transition/maps007.c
index 93f849c..ea09a76 100644
--- a/test/zdtm/live/transition/maps007.c
+++ b/test/zdtm/live/transition/maps007.c
@@ -37,7 +37,7 @@ int main(int argc, char **argv)
void *start, *end, *p;
pid_t child;
struct {
- uint32_t delta;
+ futex_t delta;
futex_t stop;
} *shm;
uint32_t v;
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
end = start + MEM_SIZE;
v = 0;
- atomic_set(&shm->delta, v);
+ futex_set(&shm->delta, v);
futex_set(&shm->stop, 0);
child = fork();
@@ -79,15 +79,16 @@ int main(int argc, char **argv)
int prot = PROT_NONE;
if (child) {
- atomic_inc(&shm->delta);
+ futex_wait_while_gt(&shm->delta, 2 * MAX_DELTA);
+ futex_inc(&shm->delta);
} else {
if (!futex_get(&shm->stop))
/* MAX_DELTA steps behind the parent */
- while (atomic_get(&shm->delta) < MAX_DELTA &&
+ while (futex_get(&shm->delta) < MAX_DELTA &&
!futex_get(&shm->stop));
else if (atomic_get(&shm->delta) == 0)
break;
- atomic_dec(&shm->delta);
+ futex_dec_and_wake(&shm->delta);
}
count++;
--
1.8.5.3
More information about the CRIU
mailing list