Re: Spinlocks, yet again: analysis and proposed patches - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Spinlocks, yet again: analysis and proposed patches
Date
Msg-id 23617.1126550907@sss.pgh.pa.us
Whole thread Raw
In response to Re: Spinlocks, yet again: analysis and proposed patches  ("Michael Paesold" <mpaesold@gmx.at>)
Responses Re: Spinlocks, yet again: analysis and proposed patches
List pgsql-hackers
"Michael Paesold" <mpaesold@gmx.at> writes:
> It seems to me the slock-no-cmpb is a win in any case. The spin-delay patch 
> does not really help much on this machine. That seems to match Stephen 
> Frost's results with EM64T, if I read them correctly.

Yeah, it's interesting that you both see slock-no-cmpb as saving some
cycles and the second patch as giving them back.  I wonder whether the
integer-modulo-to-slow-the-loop trick is counterproductive on your
machines.  You both seem to be using hardware that will recognize
rep;nop and maybe that's all that's needed.

I probably should have broken down the spindelay patch into multiple
components.  But it's only a small change --- could you try simplifying
the patched line
    if ((--spins % MAX_SPINS_PER_DELAY) == 0)

to
    if (--spins == 0)

and see how the patch does that way?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Michael Paesold"
Date:
Subject: Re: Spinlocks, yet again: analysis and proposed patches
Next
From: "Michael Paesold"
Date:
Subject: Re: Spinlocks, yet again: analysis and proposed patches