Re: [COMMITTERS] pgsql: Reduce the number of semaphores used under --disable-spinlocks.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Reduce the number of semaphores used under --disable-spinlocks.
Date: 2014-06-18 20:38:09
Message-ID: CA+TgmoY=OTwGJyo3LH=J3iZhjU6E7wRn_tm1vJMKytCBRQu6xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Jun 18, 2014 at 3:56 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>> > I'm looking at the way you did this in the context of the atomics
>> > patch. Won't:
>> > s_init_lock_sema(volatile slock_t *lock)
>> > {
>> > static int counter = 0;
>> >
>> > *lock = (++counter) % NUM_SPINLOCK_SEMAPHORES;
>> > }
>> >
>> > lead to bad results if spinlocks are intialized after startup?
>>
>> Why?
>
> Because every further process will start with a copy of the postmaster's
> counter or with 0 (EXEC_BACKEND)?

Oh, true. Maybe we should randomize that.

>> > Essentially mapping new spinlocks to the same semaphore?
>>
>> Yeah, but so what? If we're mapping a bajillion spinlocks to the same
>> semaphore already, what's a few more?
>
> Well, imagine something like parallel query creating new segments,
> including a spinlock (possibly via a lwlock) at runtime. If there were
> several backends processing such queries this they'd all map to the same
> semaphore.

Yeah.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2014-06-18 23:32:43 pgsql: Remove unnecessary check for jbvBinary in convertJsonbValue.
Previous Message Andres Freund 2014-06-18 19:56:49 Re: [COMMITTERS] pgsql: Reduce the number of semaphores used under --disable-spinlocks.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-06-18 20:41:30 Re: idle_in_transaction_timeout
Previous Message Fabrízio de Royes Mello 2014-06-18 20:25:28 Re: How about a proper TEMPORARY TABLESPACE?