Re: [HACKERS] Spinlock backoff algorithm

2007-11-19 Thread Zdenek Kotala
Gregory Stark wrote: "Tom Lane" <[EMAIL PROTECTED]> writes: Mark Mielke <[EMAIL PROTECTED]> writes: Tom Lane wrote: My goodness that's a hardware-dependent proposal. Shall we discuss how many CPUs there are where an integer division is *slower* than a floating-point op? Do you have one in m

Re: [HACKERS] Spinlock backoff algorithm

2007-11-17 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > Mark Mielke <[EMAIL PROTECTED]> writes: >> Tom Lane wrote: >>> My goodness that's a hardware-dependent proposal. Shall we discuss >>> how many CPUs there are where an integer division is *slower* than >>> a floating-point op? > >> Do you have one in mind,

Off-Topic: Float point division academia? (was: Re: [HACKERS] Spinlock backoff algorithm)

2007-11-16 Thread Mark Mielke
Martijn van Oosterhout wrote: On Wed, Nov 14, 2007 at 06:57:18PM -0800, Josh Berkus wrote: The question is, for our most common platforms (like AMD and Intel) is the FPU notably slower/more contended than integer division? I'd the impression that it was, but my knowledge of chip architectur

Re: [HACKERS] Spinlock backoff algorithm

2007-11-16 Thread Martijn van Oosterhout
On Wed, Nov 14, 2007 at 06:57:18PM -0800, Josh Berkus wrote: > The question is, for our most common platforms (like AMD and Intel) is the > FPU > notably slower/more contended than integer division? I'd the impression that > it was, but my knowledge of chip architectures is liable to be out of

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > Nah, if it's only Niagara, it's not worth bothering. It's not only that aspect of it --- it's that I am 100% convinced that Magne has misidentified the source of whatever FPU contention he's seeing. The floating-point code in s_lock() is executed only jus

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Josh Berkus
Greg, > That says precisely nothing about the matter at hand. Someone should > simply change it and benchmark it in pgsql. I doubt you'll see a > difference there on regular AMD/Intel ... and if it makes the sun > hyperthreaded cpu happier... Nah, if it's only Niagara, it's not worth bothering.

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Joshua D. Drake
Gregory Maxwell wrote: On Nov 14, 2007 10:12 PM, Joshua D. Drake <[EMAIL PROTECTED]> wrote: http://www.intel.com/performance/server/xeon/intspd.htm http://www.intel.com/performance/server/xeon/fpspeed.htm That says precisely nothing about the matter at hand. Someone should simply change it and

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Gregory Maxwell
On Nov 14, 2007 10:12 PM, Joshua D. Drake <[EMAIL PROTECTED]> wrote: > http://www.intel.com/performance/server/xeon/intspd.htm > http://www.intel.com/performance/server/xeon/fpspeed.htm That says precisely nothing about the matter at hand. Someone should simply change it and benchmark it in pgsql.

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Steve Atkins
On Nov 14, 2007, at 6:57 PM, Josh Berkus wrote: Tom, I've got one upstairs (HPPA), and I believe that it's actually a pretty common situation in scientifically-oriented workstations from a few years back. Last I checked, scientific workstations aren't exactly a common platform for Post

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Joshua D. Drake
Josh Berkus wrote: Tom, I've got one upstairs (HPPA), and I believe that it's actually a pretty common situation in scientifically-oriented workstations from a few years back. Last I checked, scientific workstations aren't exactly a common platform for PostgreSQL servers. The question is,

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Josh Berkus
Tom, > I've got one upstairs (HPPA), and I believe that it's actually a pretty > common situation in scientifically-oriented workstations from a few > years back. Last I checked, scientific workstations aren't exactly a common platform for PostgreSQL servers. The question is, for our most commo

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Trevor Talbot
On 11/14/07, Tom Lane <[EMAIL PROTECTED]> wrote: > The other problem with using modulo is that it makes the result depend > mostly on the low-order bits of the random() result, rather than mostly > on the high-order bits; with lower-grade implementations of random(), > the lower bits are materiall

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Greg Smith
On Wed, 14 Nov 2007, Mark Mielke wrote: The other problem with using modulo is that it makes the result depend mostly on the low-order bits of the random() result, rather than mostly on the high-order bits; with lower-grade implementations of random(), the lower bits are materially less random t

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Tom Lane
Mark Mielke <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> My goodness that's a hardware-dependent proposal. Shall we discuss >> how many CPUs there are where an integer division is *slower* than >> a floating-point op? > Do you have one in mind, or is this a straw man? :-) I've got one upstai

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Mark Mielke
Tom Lane wrote: =?ISO-8859-1?Q?Magne_M=E6hre?= <[EMAIL PROTECTED]> writes: I understand the reasoning for the backoff (as of the discussion on 2003-08-05), but is there any particular reason for using floating point operations here ? Maybe a modulo would be just as good (or better since it

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Tom Lane
=?ISO-8859-1?Q?Magne_M=E6hre?= <[EMAIL PROTECTED]> writes: > I understand the reasoning for the backoff (as of the discussion on > 2003-08-05), but is there any particular reason for using floating > point operations here ? Maybe a modulo would be just as good (or > better since it doesn't involv

Re: [HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Zdenek Kotala
Magne Mæhre wrote: I was playing with a Nevada server and noticed a rush on the FPU (the Nevada has a single shared FPU for its 32 threads). Probably you mean Niagara ;-). Zdenek ---(end of broadcast)--- TIP 1: if posting/readi

[HACKERS] Spinlock backoff algorithm

2007-11-14 Thread Magne Mæhre
I was playing with a Nevada server and noticed a rush on the FPU (the Nevada has a single shared FPU for its 32 threads). Looking at the spinlock code, I found : cur_delay += (int) (cur_delay * ((double) random() / (double) MAX_RANDOM_VALUE) + 0.5); I understand the reasoning for the