Thanks to visit codestin.com
Credit goes to postgrespro.com

Re: Wierd context-switching issue on Xeon - Mailing list pgsql-performance

From Tom Lane
Subject Re: Wierd context-switching issue on Xeon
Date
Msg-id [email protected]
Whole thread Raw
In response to Re: Wierd context-switching issue on Xeon  (Greg Stark <[email protected]>)
List pgsql-performance
Greg Stark <[email protected]> writes:
> There's nothing about the way Postgres spinlocks are coded that affects this?

No.  AFAICS our spinlock sequences are pretty much equivalent to the way
the Linux kernel codes its spinlocks, so there's no deep dark knowledge
to be mined there.

We could possibly use some more-efficient blocking mechanism than semop()
once we've decided we have to block (it's a shame Linux still doesn't
have cross-process POSIX semaphores).  But the striking thing I learned
from looking at the oprofile results is that most of the inefficiency
comes at the very first TAS() operation, before we've even "spun" let
alone decided we have to block.  The s_lock() subroutine does not
account for more than a few percent of the runtime in these tests,
compared to 15% at the inline TAS() operations in LWLockAcquire and
LWLockRelease.  I interpret this to mean that once it's acquired
ownership of the cache line, a Xeon can get through the "spinning"
loop in s_lock() mighty quickly.

            regards, tom lane

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Wierd context-switching issue on Xeon
Next
From: Bruno Wolff III
Date:
Subject: Re: Horribly slow hash join