Re: Spinlocks, yet again: analysis and proposed patches
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Michael Paesold" <mpaesold@gmx.at>
Cc: pgsql-hackers@postgresql.org, Stephen Frost <sfrost@snowman.net>
Date: 2005-09-12T18:48:27Z
Lists: 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