From: Kenneth Marshall <ktm@it.is.rice.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Wierd context-switching issue on Xeon
Date: Wed, 21 Apr 2004 17:02:31 -0500
Message-ID: <20040421220231.GA18010@it.is.rice.edu> (raw)
In-Reply-To: <14264.1082573491@sss.pgh.pa.us>
References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509814A@vt-pe2550-001.vantage.vantage.com>
<200404200959.52813.josh@agliodbs.com>
<1082515263.1558.214.camel@localhost.localdomain>
<78427208-93C0-11D8-BA67-000393BD6C3E@tuckfield.com>
<14264.1082573491@sss.pgh.pa.us>
On Wed, Apr 21, 2004 at 02:51:31PM -0400, Tom Lane wrote:
> The context swap storm is happening because of contention at the next
> level up (LWLocks rather than spinlocks). It could be an independent
> issue that just happens to be triggered by the same sort of access
> pattern. I put forward a hypothesis that the cache miss storm caused by
> the test-and-set ops induces the context swap storm by making the code
> more likely to be executing in certain places at certain times ... but
> it's only a hypothesis.
>
If the context swap storm derives from LWLock contention, maybe using
a random order to assign buffer locks in buf_init.c would prevent
simple adjacency of buffer allocation to cause the storm. Just offsetting
the assignment by the cacheline size should work. I notice that when
initializing the buffers in shared memory, both the buf->meta_data_lock
and the buf->cntx_lock are immediately adjacent in memory. I am not
familiar enough with the flow through postgres to see if there could
be "fighting" for those two locks. If so, offsetting those by the cache
line size would also stop the context swap storm.
--Ken
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: ktm@it.is.rice.edu, tgl@sss.pgh.pa.us
Subject: Re: Wierd context-switching issue on Xeon
In-Reply-To: <20040421220231.GA18010@it.is.rice.edu>
* 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