public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] don't use ld.bias
@ 2003-07-21 23:55 Jesse Barnes
  2003-07-22  0:15 ` Chen, Kenneth W
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jesse Barnes @ 2003-07-21 23:55 UTC (permalink / raw)
  To: linux-ia64

Patch to fix spin_lock to not use ld.bias since it causes a bunch of bus
activity that hurts scalability when a lock is contended.

Thanks,
Jesse

=== include/asm-ia64/spinlock.h 1.13 vs edited ==--- 1.13/include/asm-ia64/spinlock.h	Fri May 30 19:59:40 2003
+++ edited/include/asm-ia64/spinlock.h	Mon Jul 21 16:54:15 2003
@@ -93,13 +93,16 @@
  * Streamlined test_and_set_bit(0, (x)).  We use test-and-test-and-set
  * rather than a simple xchg to avoid writing the cache-line when
  * there is contention.
+ *
+ * Don't use ld.bias since it generates unnecessary bus activity on
+ * multiprocessor systems when the lock is contended.
  */
 #define _raw_spin_lock(x) __asm__ __volatile__ (		\
 	"mov ar.ccv = r0\n"					\
 	"mov r29 = 1\n"						\
 	";;\n"							\
 	"1:\n"							\
-	"ld4.bias r2 = [%0]\n"					\
+	"ld4 r2 = [%0]\n"					\
 	";;\n"							\
 	"cmp4.eq p0,p7 = r0,r2\n"				\
 	"(p7) br.cond.spnt.few 1b \n"				\

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] don't use ld.bias
  2003-07-21 23:55 [PATCH] don't use ld.bias Jesse Barnes
@ 2003-07-22  0:15 ` Chen, Kenneth W
  2003-07-22 13:11 ` Jesse Barnes
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Chen, Kenneth W @ 2003-07-22  0:15 UTC (permalink / raw)
  To: linux-ia64

> Patch to fix spin_lock to not use ld.bias since it causes a bunch of
bus
> activity that hurts scalability when a lock is contended.

It's dangerous to say something without knowing the whole context, but I
can't resist asking why not fix the contended lock area instead?  Sounds
like you have some serious contention.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] don't use ld.bias
  2003-07-21 23:55 [PATCH] don't use ld.bias Jesse Barnes
  2003-07-22  0:15 ` Chen, Kenneth W
@ 2003-07-22 13:11 ` Jesse Barnes
  2003-07-23  4:40 ` Mallick, Asit K
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jesse Barnes @ 2003-07-22 13:11 UTC (permalink / raw)
  To: linux-ia64

On Mon, Jul 21, 2003 at 05:15:39PM -0700, Chen, Kenneth W wrote:
> > Patch to fix spin_lock to not use ld.bias since it causes a bunch of
> bus
> > activity that hurts scalability when a lock is contended.
> 
> It's dangerous to say something without knowing the whole context, but I
> can't resist asking why not fix the contended lock area instead?  Sounds
> like you have some serious contention.

Maybe I shouldn't have said 'contended'.  This causes problems even when
a lock is nearly uncontended.  I agree that fixing lock contention is a
good idea, but as I read this code, it'll only make the very best case
(totally uncontended) only a little better than if the ld.bias were just
an ld and it makes the average and contended cases _much_ worse.

I can get some data if you're not convinced by reading the code :)

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] don't use ld.bias
  2003-07-21 23:55 [PATCH] don't use ld.bias Jesse Barnes
  2003-07-22  0:15 ` Chen, Kenneth W
  2003-07-22 13:11 ` Jesse Barnes
@ 2003-07-23  4:40 ` Mallick, Asit K
  2003-07-23 12:00 ` Matthew Wilcox
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mallick, Asit K @ 2003-07-23  4:40 UTC (permalink / raw)
  To: linux-ia64

It does make sense to not use the ld.bias in the spinlock, it will make
more cacheline bouncing in a larger SMP system.
Thanks,
Asit


> -----Original Message-----
> From: Jesse Barnes [mailto:jbarnes@sgi.com] 
> Sent: Tuesday, July 22, 2003 6:12 AM
> To: Chen, Kenneth W
> Cc: linux-ia64@vger.kernel.org; davidm@hpl.hp.com
> Subject: Re: [PATCH] don't use ld.bias
> 
> 
> On Mon, Jul 21, 2003 at 05:15:39PM -0700, Chen, Kenneth W wrote:
> > > Patch to fix spin_lock to not use ld.bias since it causes 
> a bunch of
> > bus
> > > activity that hurts scalability when a lock is contended.
> > 
> > It's dangerous to say something without knowing the whole 
> context, but I
> > can't resist asking why not fix the contended lock area 
> instead?  Sounds
> > like you have some serious contention.
> 
> Maybe I shouldn't have said 'contended'.  This causes 
> problems even when
> a lock is nearly uncontended.  I agree that fixing lock 
> contention is a
> good idea, but as I read this code, it'll only make the very best case
> (totally uncontended) only a little better than if the 
> ld.bias were just
> an ld and it makes the average and contended cases _much_ worse.
> 
> I can get some data if you're not convinced by reading the code :)
> 
> Thanks,
> Jesse
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-ia64" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] don't use ld.bias
  2003-07-21 23:55 [PATCH] don't use ld.bias Jesse Barnes
                   ` (2 preceding siblings ...)
  2003-07-23  4:40 ` Mallick, Asit K
@ 2003-07-23 12:00 ` Matthew Wilcox
  2003-07-25  1:10 ` David Mosberger
  2003-07-25 13:40 ` Jesse Barnes
  5 siblings, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2003-07-23 12:00 UTC (permalink / raw)
  To: linux-ia64

On Tue, Jul 22, 2003 at 09:40:02PM -0700, Mallick, Asit K wrote:
> It does make sense to not use the ld.bias in the spinlock, it will make
> more cacheline bouncing in a larger SMP system.

it certainly makes a mockery of the comment:

 * Streamlined test_and_set_bit(0, (x)).  We use test-and-test-and-set
 * rather than a simple xchg to avoid writing the cache-line when
 * there is contention.

since there's no real advantage (AIUI) to have the cacheline
clean-exclusive vs dirty-exclusive.

but why not delete this code?  it's under #else /* !NEW_LOCK */ and
NEW_LOCK looks to be the better code as well as the default in 2.5.

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] don't use ld.bias
  2003-07-21 23:55 [PATCH] don't use ld.bias Jesse Barnes
                   ` (3 preceding siblings ...)
  2003-07-23 12:00 ` Matthew Wilcox
@ 2003-07-25  1:10 ` David Mosberger
  2003-07-25 13:40 ` Jesse Barnes
  5 siblings, 0 replies; 7+ messages in thread
From: David Mosberger @ 2003-07-25  1:10 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Mon, 21 Jul 2003 16:55:59 -0700, jbarnes@sgi.com (Jesse Barnes) said:

  Jesse> Patch to fix spin_lock to not use ld.bias since it causes a
  Jesse> bunch of bus activity that hurts scalability when a lock is
  Jesse> contended.

Yes, using ld.bias really was wrong there.  However, instead of
applying your patch, I dropped the old lock code (which was
effectively dead code) and instead removed the .bias from the
ia64_spinlock_contention() routine in head.S.

Thanks,

	--david

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] don't use ld.bias
  2003-07-21 23:55 [PATCH] don't use ld.bias Jesse Barnes
                   ` (4 preceding siblings ...)
  2003-07-25  1:10 ` David Mosberger
@ 2003-07-25 13:40 ` Jesse Barnes
  5 siblings, 0 replies; 7+ messages in thread
From: Jesse Barnes @ 2003-07-25 13:40 UTC (permalink / raw)
  To: linux-ia64

On Thu, Jul 24, 2003 at 06:10:13PM -0700, David Mosberger wrote:
> >>>>> On Mon, 21 Jul 2003 16:55:59 -0700, jbarnes@sgi.com (Jesse Barnes) said:
> 
>   Jesse> Patch to fix spin_lock to not use ld.bias since it causes a
>   Jesse> bunch of bus activity that hurts scalability when a lock is
>   Jesse> contended.
> 
> Yes, using ld.bias really was wrong there.  However, instead of
> applying your patch, I dropped the old lock code (which was
> effectively dead code) and instead removed the .bias from the
> ia64_spinlock_contention() routine in head.S.

Even better.  Thanks.

Jesse

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-07-25 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-21 23:55 [PATCH] don't use ld.bias Jesse Barnes
2003-07-22  0:15 ` Chen, Kenneth W
2003-07-22 13:11 ` Jesse Barnes
2003-07-23  4:40 ` Mallick, Asit K
2003-07-23 12:00 ` Matthew Wilcox
2003-07-25  1:10 ` David Mosberger
2003-07-25 13:40 ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox