public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] futex_cmp_requeue01: fix test expectations
Date: Thu, 5 Dec 2019 18:19:10 -0500 (EST)	[thread overview]
Message-ID: <1013755663.15334773.1575587950733.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1965156629.13355311.1574352460203.JavaMail.zimbra@redhat.com>

Any thoughts about my last reply?

----- Original Message -----
> 
> 
> ----- Original Message -----
> > Hi!
> > > > Unless spurious wakeup has happened between the requeue and wake
> > > > operation which means that the num_requeues can be smaller because we
> > > > will wake up less than requeued processes. So if we sampled spurious
> > > > wakeups before the requeue operation and after the futex_wake() for
> > > > requeued processes and call it delta_spurious we would get a range:
> > > > 
> > > > TST_RET - num_requeues >= set_wakes
> > > 
> > > This doesn't look correct if we consider spurious wakeups:
> > > 
> > > 5 processes, set_wakes = 5, set_requeue = 0, 1 spuriously wakes up,
> > > remaining 4 are woken up by futex(), 0 are requeued:
> > > 
> > > 4 - 0 >= 5
> > 
> > Well I was betting on the fact that we wake up much less processes than
> > we attempt to lock on the futex and that waking up processes takes
> > precedence. I we can add delta_spurious to the right side that wouldn't
> > change much and we end up being correct all the time, i.e.
> > 
> > TST_RET + delta_spurious - num_requeues >= set_wakes
> 
> I'd go with just spurious instead of delta_spurious. If there is spurious
> wake up before requeue (and first sample), wouldn't that fail in same way
> as example above?
> 
> TST_RET + delta_spurious - num_requeues >= set_wakes
> 4 + 0 - 0 >= 5
> 
> Also delta_spurious looks racy, because it's based on counter
> that is increased only after user-space gets chance to run. But process
> may have been already removed from futex queue on kernel side.
> So 'first sample before requeue' can see inaccurate state.
> 
> So I'd tweak your check to:
>   set_wakes-spurious <= TST_RET-num_requeues <= set_wakes+spurious
> 
> 
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> 


  reply	other threads:[~2019-12-05 23:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 12:58 [LTP] [PATCH] futex_cmp_requeue01: fix test expectations Jan Stancek
2019-11-11 15:09 ` Cyril Hrubis
2019-11-11 16:30   ` Jan Stancek
2019-11-12 14:08     ` [LTP] [PATCH v2] " Jan Stancek
2019-11-20 16:16       ` Cyril Hrubis
2019-11-21  8:04         ` Jan Stancek
2019-11-21 11:02           ` Cyril Hrubis
2019-11-21 16:07             ` Jan Stancek
2019-12-05 23:19               ` Jan Stancek [this message]
2019-12-06 13:58                 ` Cyril Hrubis

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=1013755663.15334773.1575587950733.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox