Re: A micro-optimisation for ProcSendSignal()

2021-12-15 Thread Thomas Munro
On Tue, Aug 3, 2021 at 2:56 PM Andres Freund wrote: > On 2021-08-03 13:44:58 +1200, Thomas Munro wrote: > > In the case of buffer pin waits, we switch to storing the pgprocno of > > the waiter. In the case of SERIALIZABLE READ ONLY DEFERRABLE waits, we > > derive the pgprocno from the vxid (thoug

Re: A micro-optimisation for ProcSendSignal()

2021-08-02 Thread Andres Freund
Hi, On 2021-08-03 13:44:58 +1200, Thomas Munro wrote: > New idea. Instead of adding pgprocno to SERIALIZABLEXACT (which we > should really be trying to shrink, not grow), let's look it up by > vxid->backendId. I didn't consider that before, because I was trying > not to get tangled up with Back

Re: A micro-optimisation for ProcSendSignal()

2021-08-02 Thread Soumyadeep Chakraborty
Hey Thomas, On Mon, Aug 2, 2021 at 6:45 PM Thomas Munro wrote: > > Hi Soumyadeep, > > On Sat, Jul 24, 2021 at 5:26 PM Soumyadeep Chakraborty > wrote: > > On Tue, Jul 20, 2021 at 10:40 PM Thomas Munro > > wrote: > > > I wonder why we need this member anyway, when you can compute it from > > > t

Re: A micro-optimisation for ProcSendSignal()

2021-08-02 Thread Thomas Munro
Hi Soumyadeep, On Sat, Jul 24, 2021 at 5:26 PM Soumyadeep Chakraborty wrote: > On Tue, Jul 20, 2021 at 10:40 PM Thomas Munro wrote: > > I wonder why we need this member anyway, when you can compute it from > > the address... #define GetPGProcNumber(p) ((p) - ProcGlobal->allProcs) > > or somethin

Re: A micro-optimisation for ProcSendSignal()

2021-07-23 Thread Soumyadeep Chakraborty
HI Thomas, On Tue, Jul 20, 2021 at 10:40 PM Thomas Munro wrote: > > Slightly tangential: we should add a comment to PGPROC.pgprocno, for more > > immediate understandability: > > > > + int pgprocno; /* index of this PGPROC in ProcGlobal->allProcs */ > > I wonder why we need this member anyway, w

Re: A micro-optimisation for ProcSendSignal()

2021-07-20 Thread Thomas Munro
Hi Soumyadeep and Ashwin, Thanks for looking! On Sun, Jul 18, 2021 at 6:58 AM Soumyadeep Chakraborty wrote: > You might have missed a spot to initialize SERIALIZABLE_XACT->pgprocno in > InitPredicateLocks(), so: > > + PredXact->OldCommittedSxact->pgprocno = INVALID_PGPROCNO; The magic OldCommit

Re: A micro-optimisation for ProcSendSignal()

2021-07-17 Thread Soumyadeep Chakraborty
Hi Thomas, You might have missed a spot to initialize SERIALIZABLE_XACT->pgprocno in InitPredicateLocks(), so: + PredXact->OldCommittedSxact->pgprocno = INVALID_PGPROCNO; Slightly tangential: we should add a comment to PGPROC.pgprocno, for more immediate understandability: + int pgprocno; /* in

Re: A micro-optimisation for ProcSendSignal()

2021-06-02 Thread Thomas Munro
On Fri, Mar 12, 2021 at 12:31 AM Thomas Munro wrote: > ProcSendSignal(pid) searches the ProcArray for the given pid and then > sets that backend's procLatch. It has only two users: UnpinBuffer() > and ReleasePredicateLocks(). In both cases, we could just as easily > have recorded the pgprocno in

A micro-optimisation for ProcSendSignal()

2021-03-11 Thread Thomas Munro
Hi, ProcSendSignal(pid) searches the ProcArray for the given pid and then sets that backend's procLatch. It has only two users: UnpinBuffer() and ReleasePredicateLocks(). In both cases, we could just as easily have recorded the pgprocno instead, avoiding the locking and the searching. We'd also