From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] checkpoints: avoid unnecesasry sleep in checkpoint_wake
Date: Wed, 11 May 2016 14:23:52 +0200 [thread overview]
Message-ID: <20160511122352.GC24701@rei.lan> (raw)
In-Reply-To: <b1cd0d1691b4d5416fdc34dd6b35dee1b7909a7c.1462968075.git.jstancek@redhat.com>
Hi!
> 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.
Good catch.
> 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++;
I guess that we can also change the do { } while (waked != nr_wake) loop
to for (;;) { } now.
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2016-05-11 12:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160511122352.GC24701@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.