public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: tglx@linutronix.de, peterz@infradead.org, dvhart@linux.intel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] futex: Robustify wake_futex()
Date: Thu, 19 Feb 2015 10:56:37 +0100	[thread overview]
Message-ID: <20150219095637.GA344@gmail.com> (raw)
In-Reply-To: <1424148397.2046.101.camel@stgolabs.net>


* Davidlohr Bueso <dave@stgolabs.net> wrote:

> @@ -1674,13 +1689,19 @@ retry_private:
>  		}
>  
>  		/*
> -		 * Wake nr_wake waiters.  For requeue_pi, if we acquired the
> -		 * lock, we already woke the top_waiter.  If not, it will be
> -		 * woken by futex_unlock_pi().
> +		 * For requeue_pi, if we acquired the lock, we already woke
> +		 * the top_waiter. If not, it will be woken by futex_unlock_pi.
> +		 *
> +		 * The regular (non-pi) case is much simpler: Wake the top
> +		 * waiter (next in line) and repeat.
>  		 */
> -		if (++task_count <= nr_wake && !requeue_pi) {
> -			wake_futex(this);
> -			continue;
> +		if (!requeue_pi) {
> +			if (!wake_futex(this)) {
> +				ret = -EINVAL;
> +				break;
> +			}
> +			if (++task_count <= nr_wake)
> +				continue;
>  		}
>  

Hm, so at a first glance this change appears to go beyond 
the scope of adding a return value to wake_futex()?

For example before the change in the !requeue_pi case we'd 
only call wake_futex() if ++task_count <= nr_wake, after 
the change we always call it.

What's the intention here?

Thanks,

	Ingo

      parent reply	other threads:[~2015-02-19  9:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17  4:46 [PATCH] futex: Robustify wake_futex() Davidlohr Bueso
2015-02-18 17:07 ` Ingo Molnar
2015-02-19  1:28   ` Davidlohr Bueso
2015-02-19  9:56 ` Ingo Molnar [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=20150219095637.GA344@gmail.com \
    --to=mingo@kernel.org \
    --cc=dave@stgolabs.net \
    --cc=dvhart@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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