Unix Technical Forum

Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance

This is a discussion on Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance within the pgsql Hackers forums, part of the PostgreSQL category; --> > > Here's another version of this patch ;-) I've based it on > your patch, > > so ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 07:23 AM
Magnus Hagander
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance

> > Here's another version of this patch ;-) I've based it on
> your patch,
> > so the changes to ovalue etc should sitill be there.

>
> In the spirit of incremental improvement ... I've taken
> Magnus' version and added the proposed change to re-enable
> Qingqing's patch by skipping WaitForSingleObjectEx altogether
> in the CHECK_FOR_INTERRUPTS code path.
> I also removed WaitForSingleObjectEx in
> pgwin32_poll_signals(), which AFAICS should be just like
> CHECK_FOR_INTERRUPTS. I think this is what we are proposing
> to actually apply to 8.1beta4. I can't test it though, so
> please check it over...


That does seem right. I think the only reason it was there i nthe first
place was to deliver the APCs.

But. in theory, we can get a false positive from
UNBLOCKED_SIGNAL_QUEUE(), right? Since we do it unlocked between two
threads. If we do that, we'll "recover" in dispatch_signals, because
we'l lcheck again locked and not dispatch any signals. *but*. If this
happens, we will return EINTR even when there is no signal. That doesn't
seem correct to me. It's a very small window, but it should be possible,
no?

We probably need an actual check, so for example have
dispatch_queued_signals return a value indicating if any signals were
actually dispatched, and use that to control EINTR?

Comments? Or am I completely off being too tired right now? ;-)

//Magnus

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 07:23 AM
Qingqing Zhou
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance



On Sun, 23 Oct 2005, Magnus Hagander wrote:

>
> But. in theory, we can get a false positive from
> UNBLOCKED_SIGNAL_QUEUE(), right? Since we do it unlocked between two
> threads. If we do that, we'll "recover" in dispatch_signals, because
> we'l lcheck again locked and not dispatch any signals. *but*. If this
> happens, we will return EINTR even when there is no signal. That doesn't
> seem correct to me. It's a very small window, but it should be possible,
> no?
>
> We probably need an actual check, so for example have
> dispatch_queued_signals return a value indicating if any signals were
> actually dispatched, and use that to control EINTR?
>
> Comments? Or am I completely off being too tired right now? ;-)
>


You are not. Basically that's what I just sent an email about :-) Since
signals are not quite often happened, so I am thinking just adding a
UNBLOCKED_SIGNAL_QUEUE() is more safe maybe for now.

Regards,
Qingqing

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 07:23 AM
Tom Lane
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance

"Magnus Hagander" <mha@sollentuna.net> writes:
> But. in theory, we can get a false positive from
> UNBLOCKED_SIGNAL_QUEUE(), right?


We could have gotten a false positive from the old coding, too.
The event was certainly not any more tightly tied to the presence
of an unserviced signal flag than UNBLOCKED_SIGNAL_QUEUE, and arguably
less so.

I think this concern is irrelevant anyway. Returning EINTR from
select() is OK even if no signal was actually serviced, so long as
it doesn't recur indefinitely. EINTR just means "I didn't do the
select(), try again".

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:39 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com