mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Darren Hart <dvhart@linux.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	John Kacur <jkacur@redhat.com>
Subject: Re: [PATCH V3] futex: add futex_q static initializer
Date: Mon, 8 Nov 2010 22:48:21 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1011082247160.2900@localhost6.localdomain6> (raw)
In-Reply-To: <1289252428-18383-1-git-send-email-dvhart@linux.intel.com>

On Mon, 8 Nov 2010, Darren Hart wrote:

> The futex_q struct has grown considerably over the last couple years. I
> believe it now merits a static initializer to avoid uninitialized data
> errors (having spent more time than I care to admit debugging an uninitialized
> q.bitset in an experimental new op code).
> 
> With the key initializer built in, several of the FUTEX_KEY_INIT calls can
> be removed.
> 
> V2: use a static variable instead of an init macro.
>     use a C99 initializer and don't rely on variable ordering in the struct.
> V3: make futex_q_init const
> 
> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@elte.hu>
> CC: Eric Dumazet <eric.dumazet@gmail.com>
> CC: John Kacur <jkacur@redhat.com>
> ---
>  kernel/futex.c |   25 ++++++++++---------------
>  1 files changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/kernel/futex.c b/kernel/futex.c
> index fd3fbe1..e6df2de 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -131,6 +131,12 @@ struct futex_q {
>  	u32 bitset;
>  };
>  
> +static const struct futex_q futex_q_init = {
> +	/* list gets initialized in queue_me()*/ 
> +	.key = FUTEX_KEY_INIT,
> +	.bitset = FUTEX_BITSET_MATCH_ANY
> +};
> +
>  /*
>   * Hash buckets are shared by all the futex_keys that hash to the same
>   * location.  Each key may have multiple futex_q structures, one for each task
> @@ -1751,7 +1757,6 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags,
>  	 * rare, but normal.
>  	 */
>  retry:
> -	q->key = FUTEX_KEY_INIT;

You sure about that one in the retry path ?

> @@ -1906,11 +1907,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, int detect,
>  		hrtimer_set_expires(&to->timer, *time);
>  	}
>  
> -	q.pi_state = NULL;
> -	q.rt_waiter = NULL;
> -	q.requeue_pi_key = NULL;
>  retry:
> -	q.key = FUTEX_KEY_INIT;

Ditto

Thanks,

	tglx

  reply	other threads:[~2010-11-08 21:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 21:54 [PATCH 0/3] futex: compiler warning and cleanups Darren Hart
2010-10-27 21:54 ` [PATCH 1/3] futex: fix compiler warnings in exit_robust_list Darren Hart
2010-11-04 10:49   ` [1/3] " Uwe Kleine-König
2010-11-04 19:00     ` [PATCH V2] " Darren Hart
2010-11-10 12:20       ` Thomas Gleixner
     [not found]       ` <tip-4c115e951d80aff126468adaec7a6c7854f61ab8@git.kernel.org>
2010-11-10 16:14         ` [tip:core/urgent] futex: Address " Darren Hart
2010-11-10 20:16         ` Uwe Kleine-König
2010-11-10 20:21           ` Darren Hart
2010-11-10 20:22           ` Darren Hart
2010-10-27 21:54 ` [PATCH 2/3] futex: replace fshared and clockrt with combined flags Darren Hart
2010-11-08 16:47   ` Thomas Gleixner
2010-11-08 21:10     ` [PATCH V2] " Darren Hart
2010-10-27 21:54 ` [PATCH 3/3] futex: add futex_q static initializer Darren Hart
2010-11-08 16:42   ` Thomas Gleixner
2010-11-08 18:12     ` Peter Zijlstra
2010-11-08 19:39       ` Thomas Gleixner
2010-11-08 21:12         ` [PATCH V2] " Darren Hart
2010-11-08 21:40           ` [PATCH V3] " Darren Hart
2010-11-08 21:48             ` Thomas Gleixner [this message]
2010-11-08 21:59               ` 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=alpine.LFD.2.00.1011082247160.2900@localhost6.localdomain6 \
    --to=tglx@linutronix.de \
    --cc=dvhart@linux.intel.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®