public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Darren Hart <dvhltc@us.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Sripathi Kodi <sripathik@in.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	John Stultz <johnstul@us.ibm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Dinakar Guniguntala <dino@in.ibm.com>,
	Ulrich Drepper <drepper@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: [tip PATCH v6 6/8] RFC: futex: Add FUTEX_HAS_TIMEOUT flag to restart.futex.flags
Date: Mon, 30 Mar 2009 23:40:32 +0200	[thread overview]
Message-ID: <49D13C50.4030601@cosmosbay.com> (raw)
In-Reply-To: <20090330213821.606.93755.stgit@Aeon>

Darren Hart a écrit :
> Currently restart is only used if there is a timeout.  The requeue_pi
> functionality requires restarting to futex_lock_pi() on signal after
> wakeup in futex_wait_requeue_pi() regardless of if there was a timeout
> or not.  Using 0 for the timeout value is confusing as that could
> indicate an expired timer.  The flag makes this explicit.
> 
> Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Sripathi Kodi <sripathik@in.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: John Stultz <johnstul@us.ibm.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Dinakar Guniguntala <dino@in.ibm.com>
> Cc: Ulrich Drepper <drepper@redhat.com>
> Cc: Eric Dumazet <dada1@cosmosbay.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Jakub Jelinek <jakub@redhat.com>
> ---
> 
>  kernel/futex.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/futex.c b/kernel/futex.c
> index dd05803..f54faf5 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -1254,6 +1254,7 @@ handle_fault:
>   */
>  #define FLAGS_SHARED		0x01
>  #define FLAGS_CLOCKRT		0x02
> +#define FLAGS_HAS_TIMEOUT	0x04
>  
>  static long futex_wait_restart(struct restart_block *restart);
>  
> @@ -1493,7 +1494,7 @@ retry_private:
>  	restart->futex.val = val;
>  	restart->futex.time = abs_time->tv64;
>  	restart->futex.bitset = bitset;
> -	restart->futex.flags = 0;
> +	restart->futex.flags = FLAGS_HAS_TIMEOUT;
>  
>  	if (fshared)
>  		restart->futex.flags |= FLAGS_SHARED;
> @@ -1517,13 +1518,16 @@ static long futex_wait_restart(struct restart_block *restart)
>  {
>  	u32 __user *uaddr = (u32 __user *)restart->futex.uaddr;
>  	int fshared = 0;
> -	ktime_t t;
> +	ktime_t t, *tp = NULL;
>  
> -	t.tv64 = restart->futex.time;
> +	if (restart->futex.flags | FLAGS_HAS_TIMEOUT) {

You probably meant :

if (restart->futex.flags & FLAGS_HAS_TIMEOUT)

> +		t.tv64 = restart->futex.time;
> +		tp = &t;
> +	}
>  	restart->fn = do_no_restart_syscall;
>  	if (restart->futex.flags & FLAGS_SHARED)
>  		fshared = 1;
> -	return (long)futex_wait(uaddr, fshared, restart->futex.val, &t,
> +	return (long)futex_wait(uaddr, fshared, restart->futex.val, tp,
>  				restart->futex.bitset,
>  				restart->futex.flags & FLAGS_CLOCKRT);
>  }
> 
> 



  reply	other threads:[~2009-03-30 21:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-30 21:37 [tip PATCH v6 0/8] requeue pi implementation Darren Hart
2009-03-30 21:37 ` [tip PATCH v6 1/8] RFC: futex: futex_wait_queue_me() Darren Hart
2009-03-31  6:44   ` Thomas Gleixner
2009-03-31 14:58     ` Darren Hart
2009-03-30 21:37 ` [tip PATCH v6 2/8] RFC: futex: futex_top_waiter() Darren Hart
2009-03-30 21:37 ` [tip PATCH v6 3/8] RFC: futex: futex_lock_pi_atomic() Darren Hart
2009-03-31  6:49   ` Thomas Gleixner
2009-03-31 15:00     ` Darren Hart
2009-03-30 21:38 ` [tip PATCH v6 4/8] RFC: futex: finish_futex_lock_pi() Darren Hart
2009-03-30 21:38 ` [tip PATCH v6 5/8] RFC: rt_mutex: add proxy lock routines Darren Hart
2009-03-30 21:38 ` [tip PATCH v6 6/8] RFC: futex: Add FUTEX_HAS_TIMEOUT flag to restart.futex.flags Darren Hart
2009-03-30 21:40   ` Eric Dumazet [this message]
2009-03-30 22:40     ` Darren Hart
2009-03-30 21:38 ` [tip PATCH v6 7/8] RFC: futex: Add requeue_futex() call Darren Hart
2009-03-30 21:38 ` [tip PATCH v6 8/8] RFC: futex: add requeue_pi calls Darren Hart
2009-03-30 21:47   ` Eric Dumazet
2009-03-30 22:44     ` Darren Hart
2009-03-30 23:31       ` Darren Hart
2009-03-31  7:30   ` Thomas Gleixner
2009-03-31 18:16     ` Darren Hart
2009-03-30 21:55 ` glibc hacks for requeue_pi Darren Hart
2009-03-31  2:09 ` [tip PATCH v6 0/8] requeue pi implementation Steven Rostedt
2009-03-31  4:48   ` Darren Hart

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=49D13C50.4030601@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=dino@in.ibm.com \
    --cc=drepper@redhat.com \
    --cc=dvhltc@us.ibm.com \
    --cc=jakub@redhat.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sripathik@in.ibm.com \
    --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