pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: pg@fastcrypt.com, Josh Berkus <josh@agliodbs.com>
Cc: Paul Tuckfield <paul@tuckfield.com>
Cc: Anjan Dave <adave@vantage.com>
Cc: Neil Conway <neilc@samurai.com>
Cc: Dirk Lutzebäck <lutzeb@aeccom.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Wierd context-switching issue on Xeon patch for 7.4.1
Date: Thu, 22 Apr 2004 01:13:47 -0400
Message-ID: <20171.1082610827@sss.pgh.pa.us> (raw)
In-Reply-To: <200404220456.i3M4uFv04710@candle.pha.pa.us>
References: <200404220456.i3M4uFv04710@candle.pha.pa.us>

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> For BSDOS it has:

>     #if (CLIENT_OS == OS_FREEBSD) || (CLIENT_OS == OS_BSDOS) || \
>         (CLIENT_OS == OS_OPENBSD) || (CLIENT_OS == OS_NETBSD)
>     { /* comment out if inappropriate for your *bsd - cyp (25/may/1999) */
>       int ncpus; size_t len = sizeof(ncpus);
>       int mib[2]; mib[0] = CTL_HW; mib[1] = HW_NCPU;
>       if (sysctl( &mib[0], 2, &ncpus, &len, NULL, 0 ) == 0)
>       //if (sysctlbyname("hw.ncpu", &ncpus, &len, NULL, 0 ) == 0)
>         cpucount = ncpus;
>     }

Multiplied by how many platforms?  Ewww...

I was wondering about some sort of dynamic adaptation, roughly along the
lines of "whenever a spin loop successfully gets the lock after
spinning, decrease the allowed loop count by one; whenever we fail to
get the lock after spinning, increase by 100; if the loop count reaches,
say, 10000, decide we are on a uniprocessor and irreversibly set it to
1."  As written this would tend to incur a select() delay once per
hundred spinlock acquisitions, which is way too much, but I think we
could make it work with a sufficiently slow adaptation rate.  The tricky
part is that a slow adaptation rate means we can't have every backend
figuring this out for itself --- the right value would have to be
maintained globally, and I'm not sure how to do that without adding a
lot of overhead.

			regards, tom lane



view thread (22+ messages)  latest in thread

Message-ID: <20171.1082610827@sss.pgh.pa.us>
Permalink:  ../20171.1082610827@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20171.1082610827@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgman@candle.pha.pa.us, josh@agliodbs.com, paul@tuckfield.com, adave@vantage.com, neilc@samurai.com, lutzeb@aeccom.com
  Subject: Re: Wierd context-switching issue on Xeon patch for 7.4.1
  In-Reply-To: <20171.1082610827@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