pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Move buffer I/O and content LWLocks out of the main tranche.
Date: Tue, 15 Dec 2015 18:47:53 +0000
Message-ID: <E1a8udd-0005Tq-7b@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Move buffer I/O and content LWLocks out of the main tranche.

Move the content lock directly into the BufferDesc, so that locking and
pinning a buffer touches only one cache line rather than two.  Adjust
the definition of BufferDesc slightly so that this doesn't make the
BufferDesc any larger than one cache line (at least on platforms where
a spinlock is only 1 or 2 bytes).

We can't fit the I/O locks into the BufferDesc and stay within one
cache line, so move those to a completely separate tranche.  This
leaves a relatively limited number of LWLocks in the main tranche, so
increase the padding of those remaining locks to a full cache line,
rather than allowing adjacent locks to share a cache line, hopefully
reducing false sharing.

Performance testing shows that these changes make little difference
on laptop-class machines, but help significantly on larger servers,
especially those with more than 2 sockets.

Andres Freund, originally based on an earlier patch by Simon Riggs.
Review and cosmetic adjustments (including heavy rewriting of the
comments) by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6150a1b08a9fe7ead2b25240be46dddeae9d98e1

Modified Files
--------------
src/backend/storage/buffer/buf_init.c |   61 +++++++++++++++++++++++++++------
src/backend/storage/buffer/bufmgr.c   |   57 +++++++++++++++---------------
src/backend/storage/lmgr/lwlock.c     |   15 ++++----
src/include/storage/buf_internals.h   |   23 +++++++++----
src/include/storage/lwlock.h          |   61 ++++++++++++++++++++++++---------
src/tools/pgindent/typedefs.list      |    1 +
6 files changed, 151 insertions(+), 67 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1a8udd-0005Tq-7b@gemulon.postgresql.org>
Permalink:  ../E1a8udd-0005Tq-7b@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1a8udd-0005Tq-7b@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Move buffer I/O and content LWLocks out of the main tranche.
  In-Reply-To: <E1a8udd-0005Tq-7b@gemulon.postgresql.org>
  References: <E1a8udd-0005Tq-7b@gemulon.postgresql.org>

* 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