Re: Spin Lock sleep resolution

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, David Gould <daveg(at)sonic(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Spin Lock sleep resolution
Date: 2013-06-29 19:46:14
Message-ID: CAMkU=1zsLcXsK6DQNes15SUUckwXhqgRu30Z+jNmZv2Hr8_Ntg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 28, 2013 at 2:46 AM, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com
> wrote:

> On 27.06.2013 17:30, Robert Haas wrote:
>
>> On Wed, Jun 26, 2013 at 5:49 PM, Jeff Janes<jeff(dot)janes(at)gmail(dot)com> wrote:
>>
>>> If we think the patch has a risk of introducing subtle errors, then it
>>>
>>> probably can't be justified based on the small performance gains you saw.
>>>
>>> But if we think it has little risk, then I think it is justified simply
>>> based on cleaner code, and less confusion for people who are tracing a
>>> problematic process. If we want it to do a random escalation, it should
>>> probably look like a random escalation to the interested observer.
>>>
>>
>> I think it has little risk. If it turns out to be worse for
>> performance, we can always revert it, but I expect it'll be better or
>> a wash, and the results so far seem to bear that out. Another
>> interesting question is whether we should fool with the actual values
>> for minimum and maximum delays, but that's a separate and much harder
>> question, so I think we should just do this for now and call it good.
>>
>
> My thoughts exactly. I wanted to see if David Gould would like to do some
> testing with it, but there's realy no need to hold off committing for that,
> I'm not expecting any surprises there. Committed.
>

Thanks.

>
> Jeff, in the patch you changed the datatype of cur_delay variable from int
> to long. AFAICS that makes no difference, so I kept it as int. Let me know
> if there was a reason for that change.

I think my thought process at the time was that since the old code
multiplied by "1000L", not "1000" in the expression argument to pg_usleep,
I wanted to keep the spirit of the L in place. It seemed safer than trying
to prove to myself that it was not necessary.

If int suffices, should the L come out of the defines for MIN_DELAY_USEC
and MAX_DELAY_USEC ?

Cheers,

Jeff

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2013-06-29 19:57:42 Re: New regression test time
Previous Message Pavel Stehule 2013-06-29 19:29:23 Re: checking variadic "any" argument in parser - should be array