Re: Making wait events a bit more efficient

2021-04-03 Thread Andres Freund
On 2021-04-02 19:55:16 -0700, Andres Freund wrote: > On 2021-04-02 12:44:58 -0700, Andres Freund wrote: > > If we went for the my_wait_event_info approach there is one further > > advantage, after my change to move the wait event code into a separate > > file: wait_event.h does not need to include

Re: Making wait events a bit more efficient

2021-04-02 Thread Andres Freund
Hi, On 2021-04-02 12:44:58 -0700, Andres Freund wrote: > If we went for the my_wait_event_info approach there is one further > advantage, after my change to move the wait event code into a separate > file: wait_event.h does not need to include proc.h anymore, which seems > architecturally nice for

Re: Making wait events a bit more efficient

2021-04-02 Thread Andres Freund
Hi, On 2021-04-02 13:42:42 -0700, Zhihong Yu wrote: > I don't see where my_wait_event_info is read (there is no getter method in > the patch). There are no reads via my_wait_event_info. Once connected to shared memory, InitProcess() calls pgstat_set_wait_event_storage() to point it to &MyProc->wa

Re: Making wait events a bit more efficient

2021-04-02 Thread Zhihong Yu
Hi, Maybe I am not familiar with your patch. I don't see where my_wait_event_info is read (there is no getter method in the patch). In that case, it is fine omitting volatile in the declaration. Cheers On Fri, Apr 2, 2021 at 1:10 PM Andres Freund wrote: > Hi, > > On 2021-04-02 13:06:35 -0700,

Re: Making wait events a bit more efficient

2021-04-02 Thread Andres Freund
Hi, On 2021-04-02 13:06:35 -0700, Zhihong Yu wrote: > +extern PGDLLIMPORT uint32 *my_wait_event_info; > > It seems volatile should be added to the above declaration. Since later: > > + *(volatile uint32 *) my_wait_event_info = wait_event_info; Why? We really just want to make the store volati

Re: Making wait events a bit more efficient

2021-04-02 Thread Zhihong Yu
Hi, +extern PGDLLIMPORT uint32 *my_wait_event_info; It seems volatile should be added to the above declaration. Since later: + *(volatile uint32 *) my_wait_event_info = wait_event_info; Cheers On Fri, Apr 2, 2021 at 12:45 PM Andres Freund wrote: > Hi, > > This grew out of my patch to split

Making wait events a bit more efficient

2021-04-02 Thread Andres Freund
Hi, This grew out of my patch to split the waits event code out of pgstat.[ch], which in turn grew out of the shared memory stats patch series. pgstat_report_wait_start() and pgstat_report_wait_end() currently check pgstat_track_activities before assigning to MyProc->wait_event_info. Given the s