All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: mingo@elte.hu, tglx@linutronix.de, hpa@zytor.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: eliminate TICKET_MASK
Date: Fri, 03 Feb 2012 11:36:27 -0800	[thread overview]
Message-ID: <4F2C373B.1060508@goop.org> (raw)
In-Reply-To: <4F2C06020200007800071066@nat28.tlf.novell.com>

On 02/03/2012 07:06 AM, Jan Beulich wrote:
> The definition of it being questionable already (unnecessarily
> including a cast), and it being used in a single place that can be
> written shorter without it, remove this #define.
>
> Along the same lines, simplify __ticket_spin_is_locked()'s main
> expression, which was the more convoluted way because of needs that
> went away with the recent type changes by Jeremy.
>
> This is pure cleanup, no functional change intended.

That looks reasonable to me.

> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
>
> ---
>  arch/x86/include/asm/spinlock.h       |    4 ++--
>  arch/x86/include/asm/spinlock_types.h |    1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
>
> --- 3.3-rc2/arch/x86/include/asm/spinlock.h
> +++ 3.3-rc2-x86-ticket-mask/arch/x86/include/asm/spinlock.h
> @@ -88,14 +88,14 @@ static inline int __ticket_spin_is_locke
>  {
>  	struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
>  
> -	return !!(tmp.tail ^ tmp.head);
> +	return tmp.tail != tmp.head;
>  }
>  
>  static inline int __ticket_spin_is_contended(arch_spinlock_t *lock)
>  {
>  	struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
>  
> -	return ((tmp.tail - tmp.head) & TICKET_MASK) > 1;
> +	return (__ticket_t)(tmp.tail - tmp.head) > 1;
>  }

Yes.  I only left these unchanged the first time around because I didn't
want to inadvertently change them, but my intent was to make them more
straightforward like this.

>  
>  #ifndef CONFIG_PARAVIRT_SPINLOCKS
> --- 3.3-rc2/arch/x86/include/asm/spinlock_types.h
> +++ 3.3-rc2-x86-ticket-mask/arch/x86/include/asm/spinlock_types.h
> @@ -16,7 +16,6 @@ typedef u32 __ticketpair_t;
>  #endif
>  
>  #define TICKET_SHIFT	(sizeof(__ticket_t) * 8)
> -#define TICKET_MASK	((__ticket_t)((1 << TICKET_SHIFT) - 1))
>  
>  typedef struct arch_spinlock {
>  	union {
>
>
>

Acked-by: Jeremy Fitzhardinge <jeremy@goop.org>

Thanks,
    J

  reply	other threads:[~2012-02-03 19:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03 15:06 [PATCH] x86: eliminate TICKET_MASK Jan Beulich
2012-02-03 19:36 ` Jeremy Fitzhardinge [this message]
2012-02-07 19:40 ` [tip:x86/asm] x86/spinlocks: Eliminate TICKET_MASK tip-bot for Jan Beulich

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=4F2C373B.1060508@goop.org \
    --to=jeremy@goop.org \
    --cc=JBeulich@suse.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.