linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "André Almeida" <andrealmeid@collabora.com>
To: 6812skiii@gmail.com
Cc: peterz@infradead.org, mingo@redhat.com, tglx@linutronix.de,
	dvhart@infradead.org, dave@stgolabs.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] futex: Fix a faulty comment.
Date: Mon, 6 Dec 2021 09:12:11 -0300	[thread overview]
Message-ID: <f7d9194b-6681-48f0-b5e9-11f43d2849bd@collabora.com> (raw)
In-Reply-To: <20211204181458.10076-1-6812skiii@gmail.com>

Hi Jangwoong,

Thanks for your patch! However...

Às 15:14 de 04/12/21, 6812skiii@gmail.com escreveu:
> From: Jangwoong Kim <6812skiii@gmail.com>
> 
> We return 1, not the index of futex woken up.
> 
> Signed-off-by: Jangwoong Kim <6812skiii@gmail.com>
> ---
>  kernel/futex/waitwake.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/futex/waitwake.c b/kernel/futex/waitwake.c
> index 4ce0923f1ce3..d148e5d4956b 100644
> --- a/kernel/futex/waitwake.c
> +++ b/kernel/futex/waitwake.c
> @@ -455,8 +455,8 @@ static int futex_wait_multiple_setup(struct futex_vector *vs, int count, int *wo
>  
>  		/*
>  		 * Even if something went wrong, if we find out that a futex
> -		 * was woken, we don't return error and return this index to
> -		 * userspace
> +		 * was woken, we don't return error and make userspace aware
> +		 * of this by returning 1.

We return to userspace the value at *woken, so your fix is wrong. Have a
look at futex_wait_multiple():

		ret = futex_wait_multiple_setup(vs, count, &hint);
		if (ret) {
			if (ret > 0) {
				/* A futex was woken during setup */
				ret = hint;
			}
			return ret;
		}

When we return 1 at futex_wait_multiple_setup(), we end up returning the
hint/woken value to userspace.

Let me know if you have questions.

	André

  reply	other threads:[~2021-12-06 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 18:14 [PATCH] futex: Fix a faulty comment 6812skiii
2021-12-06 12:12 ` André Almeida [this message]
2021-12-06 17:44   ` Jangwoong Kim
2021-12-06 20:34     ` André Almeida

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=f7d9194b-6681-48f0-b5e9-11f43d2849bd@collabora.com \
    --to=andrealmeid@collabora.com \
    --cc=6812skiii@gmail.com \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).