From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <gsstark@mit.edu>
Cc: lutzeb@aeccom.com, Josh Berkus <josh@agliodbs.com>
Cc: pgsql-performance@postgresql.org, Neil Conway <neilc@samurai.com>
Subject: Re: Wierd context-switching issue on Xeon
Date: Sun, 18 Apr 2004 22:30:08 -0400
Message-ID: <14056.1082341808@sss.pgh.pa.us> (raw)
In-Reply-To: <87d6647qbg.fsf@stark.xeocode.com>
References: <200311251419.36771.josh@agliodbs.com>
<200404151039.17763.josh@agliodbs.com>
<407EE93F.3090705@aeccom.com>
<200404151335.27762.josh@agliodbs.com>
<407EFC95.5070805@aeccom.com>
<11437.1082324861@sss.pgh.pa.us>
<87d6647qbg.fsf@stark.xeocode.com>
Greg Stark <gsstark@mit.edu> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, gsstark@mit.edu, josh@agliodbs.com, neilc@samurai.com
Subject: Re: Wierd context-switching issue on Xeon
In-Reply-To: <14056.1082341808@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox