From: "Luck, Tony" <tony.luck@intel.com>
To: linux-ia64@vger.kernel.org
Subject: RE: [git pull] ia64 changes
Date: Mon, 28 Sep 2009 22:35:27 +0000 [thread overview]
Message-ID: <4ac13a2f28573cec9e@agluck-desktop.sc.intel.com> (raw)
In-Reply-To: <1FE6DD409037234FAB833C420AA843EC0122AEB1@orsmsx424.amr.corp.intel.com>
Here are the source and disassembled binary for the lock/unlock
routines modified as suggested by Linus to fit the lock word
back into 32-bits.
Performance for lock/unlock time in the uncontended in-cache case
is a little worse (another 8% on top of the 8% I'd already given
up compared to the original "xchg" version). I haven't tried a
macro-level benchmark yet to see whether this makes it noticeable.
-Tony
#define TICKET_SHIFT 17
#define TICKET_BITS 15
static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
{
int *p = (int *)&lock->lock, ticket, serve;
ticket = ia64_fetchadd(1, p, acq);
if (!(((ticket >> TICKET_SHIFT) ^ ticket) & ((1L << TICKET_BITS) - 1)))
return;
do {
cpu_relax();
serve = ACCESS_ONCE(*p);
} while (((serve >> TICKET_SHIFT) ^ ticket) & ((1 << TICKET_BITS) - 1));
}
a000000100815d00 <_spin_lock>:
a000000100815d00: [MII] fetchadd4.acq r14=[r32],1
a000000100815d06: nop.i 0x0
a000000100815d0c: nop.i 0x0;;
a000000100815d10: [MII] nop.m 0x0
a000000100815d16: extr r3=r14,17,15
a000000100815d1c: mov r172767
a000000100815d20: [MMI] mov r16=r14;;
a000000100815d26: xor r2=r14,r3
a000000100815d2c: nop.i 0x0;;
a000000100815d30: [MII] nop.m 0x0
a000000100815d36: extr.u r15=r2,0,15;;
a000000100815d3c: nop.i 0x0
a000000100815d40: [MMB] cmp.eq p6,p7=0,r15
a000000100815d46: nop.m 0x0
a000000100815d4c: (p06) br.ret.dpnt.many b0
a000000100815d50: [MMI] hint.m 0x0
a000000100815d56: nop.m 0x0
a000000100815d5c: nop.i 0x0;;
a000000100815d60: [MMI] ld4.acq r11=[r32];;
a000000100815d66: nop.m 0x0
a000000100815d6c: extr r10=r11,17,15;;
a000000100815d70: [MMI] xor r9=r16,r10;;
a000000100815d76: and r8=r17,r9
a000000100815d7c: nop.i 0x0;;
a000000100815d80: [MIB] nop.m 0x0
a000000100815d86: cmp4.eq p9,p8=0,r8
a000000100815d8c: (p08) br.cond.dptk.few a000000100815d50 <_spin_lock+0x50>
a000000100815d90: [MIB] nop.m 0x0
a000000100815d96: nop.i 0x0
a000000100815d9c: br.ret.sptk.many b0;;
static __always_inline void __ticket_spin_unlock(raw_spinlock_t *lock)
{
unsigned short *p = (unsigned short *)&lock->lock + 1, tmp;
asm volatile ("ld2.bias %0=[%1]" : "=r"(tmp) : "r"(p));
ACCESS_ONCE(*p) = (tmp + 2) & ~1;
}
a00000010000a4a0: [MII] mov r36e534
...
a00000010000a4d0: [MII] ld2.bias r9=[r34]
a00000010000a4d6: nop.i 0x0
a00000010000a4dc: nop.i 0x0;;
a00000010000a4e0: [MMI] adds r8=2,r9;;
a00000010000a4e6: and r3=r36,r8
a00000010000a4ec: nop.i 0x0
a00000010000a4f0: [MMI] nop.m 0x0;;
a00000010000a4f6: st2.rel [r34]=r3
next prev parent reply other threads:[~2009-09-28 22:35 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-18 16:34 [git pull] ia64 changes Luck, Tony
2008-04-22 23:36 ` Luck, Tony
2008-04-24 23:51 ` Luck, Tony
2008-04-25 0:16 ` Adrian Bunk
2008-04-25 0:25 ` Luck, Tony
2008-04-25 0:41 ` [2.6 patch] ia64: let NUMA select SMP Adrian Bunk
2008-04-25 1:01 ` Luck, Tony
2008-04-25 12:50 ` Mike Travis
2008-04-29 23:36 ` [git pull] ia64 changes Luck, Tony
2008-05-01 22:57 ` Luck, Tony
2008-05-15 20:46 ` Luck, Tony
2008-05-28 19:52 ` Luck, Tony
2008-06-16 17:28 ` Luck, Tony
2008-06-24 21:49 ` Luck, Tony
2008-06-30 23:52 ` Luck, Tony
2008-07-17 20:31 ` Luck, Tony
2008-07-25 20:30 ` Luck, Tony
2008-08-06 18:32 ` Luck, Tony
2008-08-12 21:55 ` Luck, Tony
2008-08-18 23:46 ` Luck, Tony
2008-08-26 16:59 ` Luck, Tony
2008-09-10 21:17 ` Luck, Tony
2008-09-23 16:59 ` Luck, Tony
2008-09-30 16:18 ` Luck, Tony
2008-10-21 18:01 ` Luck, Tony
2008-11-05 0:43 ` Luck, Tony
2008-11-07 18:00 ` Luck, Tony
2008-11-20 22:47 ` Luck, Tony
2008-12-09 22:28 ` Luck, Tony
2009-01-15 19:45 ` Luck, Tony
2009-02-19 21:02 ` Luck, Tony
2009-02-25 22:44 ` Luck, Tony
2009-03-06 22:17 ` Luck, Tony
2009-03-27 17:46 ` Luck, Tony
2009-04-01 20:20 ` Luck, Tony
2009-04-08 22:33 ` Luck, Tony
2009-04-20 17:32 ` Luck, Tony
2009-05-05 22:42 ` Luck, Tony
2009-06-15 17:20 ` Luck, Tony
2009-07-17 18:11 ` Fenghua Yu
2009-08-11 23:40 ` Fenghua Yu
2009-09-02 17:28 ` Luck, Tony
2009-09-17 17:11 ` Luck, Tony
2009-09-26 19:57 ` Luck, Tony
2009-09-26 20:39 ` Linus Torvalds
2009-09-26 23:16 ` Matthew Wilcox
2009-09-27 0:00 ` Linus Torvalds
2009-09-27 0:08 ` Linus Torvalds
2009-09-27 4:54 ` Luck, Tony
2009-09-27 5:18 ` Linus Torvalds
2009-09-27 5:20 ` Luck, Tony
2009-09-28 19:02 ` Boehm, Hans
2009-09-28 22:35 ` Luck, Tony [this message]
2009-09-28 22:54 ` Linus Torvalds
2009-09-28 23:01 ` Linus Torvalds
2009-09-28 23:01 ` Luck, Tony
2009-09-29 0:03 ` Rick Jones
2009-09-29 0:14 ` Linus Torvalds
2009-09-29 17:53 ` Luck, Tony
2009-09-29 18:07 ` Linus Torvalds
2009-09-30 0:54 ` Robin Holt
2009-09-30 1:24 ` Linus Torvalds
2009-09-30 1:30 ` Linus Torvalds
2009-09-30 2:46 ` Robin Holt
2009-09-30 2:56 ` Linus Torvalds
2009-09-30 18:00 ` Rick Jones
2009-11-02 18:07 ` Luck, Tony
2009-12-15 22:33 ` Luck, Tony
2010-01-08 17:20 ` Luck, Tony
2010-01-08 17:35 ` Linus Torvalds
2010-01-08 17:49 ` Luck, Tony
2010-01-08 19:24 ` Luck, Tony
2010-02-16 19:43 ` Luck, Tony
2010-02-24 17:32 ` Luck, Tony
2010-03-01 18:11 ` Luck, Tony
2010-05-18 17:11 ` Luck, Tony
2010-05-18 20:43 ` Robin Holt
2010-05-18 22:04 ` Luck, Tony
2010-07-01 15:22 ` Luck, Tony
2010-08-04 16:09 ` Luck, Tony
2010-08-14 4:04 ` Luck, Tony
2010-08-18 20:06 ` Luck, Tony
2010-09-13 18:33 ` Luck, Tony
2010-09-14 6:06 ` Petr Tesarik
2010-09-14 7:02 ` Petr Tesarik
2010-09-14 17:37 ` Luck, Tony
2010-09-14 20:38 ` Petr Tesarik
2010-09-14 20:57 ` Tony Luck
2010-09-16 15:57 ` Luck, Tony
2010-10-21 16:00 ` Luck, Tony
2010-10-21 21:33 ` Linus Torvalds
2011-01-10 18:01 ` Luck, Tony
2011-01-13 18:08 ` Luck, Tony
2011-01-13 23:10 ` Luck, Tony
2011-01-14 19:33 ` Luck, Tony
2011-03-24 16:29 ` Luck, Tony
2011-03-30 19:09 ` Luck, Tony
2011-05-31 20:20 ` Luck, Tony
2011-08-01 16:57 ` Luck, Tony
2011-11-02 21:06 ` Luck, Tony
2012-01-05 17:42 ` Luck, Tony
2012-03-23 17:23 ` [GIT PULL] " Luck, Tony
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=4ac13a2f28573cec9e@agluck-desktop.sc.intel.com \
--to=tony.luck@intel.com \
--cc=linux-ia64@vger.kernel.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