All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] checkpoints: avoid unnecesasry sleep in checkpoint_wake
@ 2016-05-11 12:03 Jan Stancek
  2016-05-11 12:03 ` [LTP] [PATCH 2/2] pause01: rewrite testcase Jan Stancek
  2016-05-11 12:23 ` [LTP] [PATCH 1/2] checkpoints: avoid unnecesasry sleep in checkpoint_wake Cyril Hrubis
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Stancek @ 2016-05-11 12:03 UTC (permalink / raw)
  To: ltp

checkpoint_wake is currently sleeping also in case when
it wakes up all processes. This creates problem for combination
of checkpoints and process_state_wait, because it creates
false impression, that child is sleeping on operation
following checkpoint_wake (#2), while it really sleeps inside
checkpoint_wake (#1).

      child                      parent
TST_CHECKPOINT_WAKE #1
                               TST_CHECKPOINT_WAIT
                               TST_PROCESS_STATE_WAIT(child, 'S')
                               kill(child, SIGINT)
sleep() #2

This patch avoids sleep in checkpoint_wake if all processes has been
already woken up.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 lib/tst_checkpoint.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c
index 8f23ead26a8a..128e658153c6 100644
--- a/lib/tst_checkpoint.c
+++ b/lib/tst_checkpoint.c
@@ -109,6 +109,10 @@ int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake,
 	do {
 		waked += syscall(SYS_futex, &tst_futexes[id], FUTEX_WAKE,
 				 INT_MAX, NULL);
+
+		if (waked == nr_wake)
+			break;
+
 		usleep(1000);
 		msecs++;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-12  9:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 12:03 [LTP] [PATCH 1/2] checkpoints: avoid unnecesasry sleep in checkpoint_wake Jan Stancek
2016-05-11 12:03 ` [LTP] [PATCH 2/2] pause01: rewrite testcase Jan Stancek
2016-05-11 13:21   ` Cyril Hrubis
2016-05-12  9:11     ` Jan Stancek
2016-05-12  9:14       ` Cyril Hrubis
2016-05-11 12:23 ` [LTP] [PATCH 1/2] checkpoints: avoid unnecesasry sleep in checkpoint_wake Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.