0.13% 0.10% 11727 postgres postgres [.] ProcArrayAdd Percent | Source code & Disassembly of postgres for minor-faults (445 samples, percent: local period) ----------------------------------------------------------------------------------------------------------- : : : : 3 Disassembly of section .text: : : 5 00000000006b58ba : : 6 /* : 7 * Add the specified PGPROC to the shared array. : 8 */ : 9 void : 10 ProcArrayAdd(PGPROC *proc) : 11 { 0.00 : 6b58ba: endbr64 0.00 : 6b58be: push %rbp 0.00 : 6b58bf: mov %rsp,%rbp 0.00 : 6b58c2: sub $0x30,%rsp 0.00 : 6b58c6: mov %rdi,-0x28(%rbp) : 17 int pgprocno = GetNumberFromPGProc(proc); 0.00 : 6b58ca: mov 0x68617f(%rip),%rax # d3ba50 0.00 : 6b58d1: mov (%rax),%rax 0.00 : 6b58d4: mov -0x28(%rbp),%rdx 0.00 : 6b58d8: sub %rax,%rdx 0.00 : 6b58db: sar $0x7,%rdx 0.00 : 6b58df: movabs $0x6db6db6db6db6db7,%rax 0.00 : 6b58e9: imul %rdx,%rax 0.00 : 6b58ed: mov %eax,-0x18(%rbp) : 26 ProcArrayStruct *arrayP = procArray; 0.00 : 6b58f0: mov 0x683ea9(%rip),%rax # d397a0 0.00 : 6b58f7: mov %rax,-0x8(%rbp) : 29 int index; : 30 int movecount; : : 32 /* See ProcGlobal comment explaining why both locks are held */ : 33 LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); 0.00 : 6b58fb: mov 0x68535e(%rip),%rax # d3ac60 0.00 : 6b5902: add $0x200,%rax 0.00 : 6b5908: mov $0x0,%esi 0.00 : 6b590d: mov %rax,%rdi 0.00 : 6b5910: call 6d48a7 : 39 LWLockAcquire(XidGenLock, LW_EXCLUSIVE); 0.00 : 6b5915: mov 0x685344(%rip),%rax # d3ac60 0.00 : 6b591c: add $0x180,%rax 0.00 : 6b5922: mov $0x0,%esi 0.00 : 6b5927: mov %rax,%rdi 0.00 : 6b592a: call 6d48a7 : : 46 if (arrayP->numProcs >= arrayP->maxProcs) 0.00 : 6b592f: mov -0x8(%rbp),%rax 65.30 : 6b5933: mov (%rax),%edx 0.00 : 6b5935: mov -0x8(%rbp),%rax 0.00 : 6b5939: mov 0x4(%rax),%eax 0.00 : 6b593c: cmp %eax,%edx 0.00 : 6b593e: jl 6b598f : 53 /* : 54 * Oops, no room. (This really shouldn't happen, since there is a : 55 * fixed supply of PGPROC structs too, and so we should have failed : 56 * earlier.) : 57 */ : 58 ereport(FATAL, 0.00 : 6b5940: mov $0x0,%esi 0.00 : 6b5945: mov $0x16,%edi 0.00 : 6b594a: call 8f9e02 0.00 : 6b594f: test %al,%al 0.00 : 6b5951: je 6b598f 0.00 : 6b5953: mov $0x30c5,%edi 0.00 : 6b5958: call 8fa699 0.00 : 6b595d: lea 0x449534(%rip),%rax # afee98 <__func__.0+0x58> 0.00 : 6b5964: mov %rax,%rdi 0.00 : 6b5967: mov $0x0,%eax 0.00 : 6b596c: call 8fa94c 0.00 : 6b5971: lea 0x4499b0(%rip),%rax # aff328 <__func__.19> 0.00 : 6b5978: mov %rax,%rdx 0.00 : 6b597b: mov $0x1e4,%esi 0.00 : 6b5980: lea 0x449531(%rip),%rax # afeeb8 <__func__.0+0x78> 0.00 : 6b5987: mov %rax,%rdi 0.00 : 6b598a: call 8fa003 : 76 * PGPROC structure in the cache. : 77 * : 78 * Since the occurrence of adding/removing a proc is much lower than the : 79 * access to the ProcArray itself, the overhead should be marginal : 80 */ : 81 for (index = 0; index < arrayP->numProcs; index++) 0.00 : 6b598f: movl $0x0,-0x1c(%rbp) 0.00 : 6b5996: jmp 6b59b9 : 84 { : 85 int this_procno = arrayP->pgprocnos[index]; 0.00 : 6b5998: mov -0x8(%rbp),%rax 0.00 : 6b599c: mov -0x1c(%rbp),%edx 0.00 : 6b599f: movslq %edx,%rdx 0.00 : 6b59a2: add $0x8,%rdx 34.70 : 6b59a6: mov 0x4(%rax,%rdx,4),%eax 0.00 : 6b59aa: mov %eax,-0x14(%rbp) : : 93 Assert(this_procno >= 0 && this_procno < (arrayP->maxProcs + NUM_AUXILIARY_PROCS)); : 94 Assert(pgxactoffs[this_procno] == index); : : 96 /* If we have found our right position in the array, break */ : 97 if (this_procno > pgprocno) 0.00 : 6b59ad: mov -0x14(%rbp),%eax 0.00 : 6b59b0: cmp -0x18(%rbp),%eax 0.00 : 6b59b3: jg 6b59c6 : 101 for (index = 0; index < arrayP->numProcs; index++) 0.00 : 6b59b5: addl $0x1,-0x1c(%rbp) 0.00 : 6b59b9: mov -0x8(%rbp),%rax 0.00 : 6b59bd: mov (%rax),%eax 0.00 : 6b59bf: cmp %eax,-0x1c(%rbp) 0.00 : 6b59c2: jl 6b5998 0.00 : 6b59c4: jmp 6b59c7 : 108 break; 0.00 : 6b59c6: nop : 110 } : : 112 movecount = arrayP->numProcs - index; 0.00 : 6b59c7: mov -0x8(%rbp),%rax 0.00 : 6b59cb: mov (%rax),%eax 0.00 : 6b59cd: sub -0x1c(%rbp),%eax 0.00 : 6b59d0: mov %eax,-0x10(%rbp) : 117 memmove(&arrayP->pgprocnos[index + 1], 0.00 : 6b59d3: mov -0x10(%rbp),%eax 0.00 : 6b59d6: cltq 0.00 : 6b59d8: lea 0x0(,%rax,4),%rdx : 121 &arrayP->pgprocnos[index], 0.00 : 6b59e0: mov -0x1c(%rbp),%eax 0.00 : 6b59e3: cltq 0.00 : 6b59e5: add $0x8,%rax 0.00 : 6b59e9: lea 0x0(,%rax,4),%rcx 0.00 : 6b59f1: mov -0x8(%rbp),%rax 0.00 : 6b59f5: add %rcx,%rax 0.00 : 6b59f8: lea 0x4(%rax),%rcx : 129 memmove(&arrayP->pgprocnos[index + 1], 0.00 : 6b59fc: mov -0x1c(%rbp),%eax 0.00 : 6b59ff: add $0x1,%eax 0.00 : 6b5a02: cltq 0.00 : 6b5a04: add $0x8,%rax 0.00 : 6b5a08: lea 0x0(,%rax,4),%rsi 0.00 : 6b5a10: mov -0x8(%rbp),%rax 0.00 : 6b5a14: add %rsi,%rax 0.00 : 6b5a17: add $0x4,%rax 0.00 : 6b5a1b: mov %rcx,%rsi 0.00 : 6b5a1e: mov %rax,%rdi 0.00 : 6b5a21: call ed240 : 141 movecount * sizeof(*arrayP->pgprocnos)); : 142 memmove(&ProcGlobal->xids[index + 1], 0.00 : 6b5a26: mov -0x10(%rbp),%eax 0.00 : 6b5a29: cltq 0.00 : 6b5a2b: lea 0x0(,%rax,4),%rdx : 146 &ProcGlobal->xids[index], 0.00 : 6b5a33: mov 0x686016(%rip),%rax # d3ba50 0.00 : 6b5a3a: mov 0x10(%rax),%rax 0.00 : 6b5a3e: mov -0x1c(%rbp),%ecx 0.00 : 6b5a41: movslq %ecx,%rcx 0.00 : 6b5a44: shl $0x2,%rcx 0.00 : 6b5a48: add %rax,%rcx : 153 memmove(&ProcGlobal->xids[index + 1], 0.00 : 6b5a4b: mov 0x685ffe(%rip),%rax # d3ba50 0.00 : 6b5a52: mov 0x10(%rax),%rax 0.00 : 6b5a56: mov -0x1c(%rbp),%esi 0.00 : 6b5a59: add $0x1,%esi 0.00 : 6b5a5c: movslq %esi,%rsi 0.00 : 6b5a5f: shl $0x2,%rsi 0.00 : 6b5a63: add %rsi,%rax 0.00 : 6b5a66: mov %rcx,%rsi 0.00 : 6b5a69: mov %rax,%rdi 0.00 : 6b5a6c: call ed240 : 164 movecount * sizeof(*ProcGlobal->xids)); : 165 memmove(&ProcGlobal->subxidStates[index + 1], 0.00 : 6b5a71: mov -0x10(%rbp),%eax 0.00 : 6b5a74: cltq 0.00 : 6b5a76: lea (%rax,%rax,1),%rdx : 169 &ProcGlobal->subxidStates[index], 0.00 : 6b5a7a: mov 0x685fcf(%rip),%rax # d3ba50 0.00 : 6b5a81: mov 0x18(%rax),%rax 0.00 : 6b5a85: mov -0x1c(%rbp),%ecx 0.00 : 6b5a88: movslq %ecx,%rcx 0.00 : 6b5a8b: add %rcx,%rcx 0.00 : 6b5a8e: add %rax,%rcx : 176 memmove(&ProcGlobal->subxidStates[index + 1], 0.00 : 6b5a91: mov 0x685fb8(%rip),%rax # d3ba50 0.00 : 6b5a98: mov 0x18(%rax),%rax 0.00 : 6b5a9c: mov -0x1c(%rbp),%esi 0.00 : 6b5a9f: add $0x1,%esi 0.00 : 6b5aa2: movslq %esi,%rsi 0.00 : 6b5aa5: add %rsi,%rsi 0.00 : 6b5aa8: add %rsi,%rax 0.00 : 6b5aab: mov %rcx,%rsi 0.00 : 6b5aae: mov %rax,%rdi 0.00 : 6b5ab1: call ed240 : 187 movecount * sizeof(*ProcGlobal->subxidStates)); : 188 memmove(&ProcGlobal->statusFlags[index + 1], 0.00 : 6b5ab6: mov -0x10(%rbp),%eax 0.00 : 6b5ab9: cltq : 191 &ProcGlobal->statusFlags[index], 0.00 : 6b5abb: mov 0x685f8e(%rip),%rdx # d3ba50 0.00 : 6b5ac2: mov 0x20(%rdx),%rcx : 194 memmove(&ProcGlobal->statusFlags[index + 1], 0.00 : 6b5ac6: mov -0x1c(%rbp),%edx 0.00 : 6b5ac9: movslq %edx,%rdx : 197 &ProcGlobal->statusFlags[index], 0.00 : 6b5acc: lea (%rcx,%rdx,1),%rsi : 199 memmove(&ProcGlobal->statusFlags[index + 1], 0.00 : 6b5ad0: mov 0x685f79(%rip),%rdx # d3ba50 0.00 : 6b5ad7: mov 0x20(%rdx),%rcx 0.00 : 6b5adb: mov -0x1c(%rbp),%edx 0.00 : 6b5ade: add $0x1,%edx 0.00 : 6b5ae1: movslq %edx,%rdx 0.00 : 6b5ae4: add %rdx,%rcx 0.00 : 6b5ae7: mov %rax,%rdx 0.00 : 6b5aea: mov %rcx,%rdi 0.00 : 6b5aed: call ed240 : 209 movecount * sizeof(*ProcGlobal->statusFlags)); : : 211 arrayP->pgprocnos[index] = GetNumberFromPGProc(proc); 0.00 : 6b5af2: mov 0x685f57(%rip),%rax # d3ba50 0.00 : 6b5af9: mov (%rax),%rax 0.00 : 6b5afc: mov -0x28(%rbp),%rdx 0.00 : 6b5b00: sub %rax,%rdx 0.00 : 6b5b03: sar $0x7,%rdx 0.00 : 6b5b07: movabs $0x6db6db6db6db6db7,%rax 0.00 : 6b5b11: imul %rdx,%rax 0.00 : 6b5b15: mov %eax,%ecx 0.00 : 6b5b17: mov -0x8(%rbp),%rax 0.00 : 6b5b1b: mov -0x1c(%rbp),%edx 0.00 : 6b5b1e: movslq %edx,%rdx 0.00 : 6b5b21: add $0x8,%rdx 0.00 : 6b5b25: mov %ecx,0x4(%rax,%rdx,4) : 225 pgxactoffs[arrayP->pgprocnos[index]] = index; 0.00 : 6b5b29: mov 0x683c80(%rip),%rdx # d397b0 0.00 : 6b5b30: mov -0x8(%rbp),%rax 0.00 : 6b5b34: mov -0x1c(%rbp),%ecx 0.00 : 6b5b37: movslq %ecx,%rcx 0.00 : 6b5b3a: add $0x8,%rcx 0.00 : 6b5b3e: mov 0x4(%rax,%rcx,4),%eax 0.00 : 6b5b42: cltq 0.00 : 6b5b44: shl $0x2,%rax 0.00 : 6b5b48: add %rax,%rdx 0.00 : 6b5b4b: mov -0x1c(%rbp),%eax 0.00 : 6b5b4e: mov %eax,(%rdx) : 237 ProcGlobal->xids[index] = proc->xid; 0.00 : 6b5b50: mov 0x685ef9(%rip),%rax # d3ba50 0.00 : 6b5b57: mov 0x10(%rax),%rax 0.00 : 6b5b5b: mov -0x1c(%rbp),%edx 0.00 : 6b5b5e: movslq %edx,%rdx 0.00 : 6b5b61: shl $0x2,%rdx 0.00 : 6b5b65: add %rax,%rdx 0.00 : 6b5b68: mov -0x28(%rbp),%rax 0.00 : 6b5b6c: mov 0x38(%rax),%eax 0.00 : 6b5b6f: mov %eax,(%rdx) : 247 ProcGlobal->subxidStates[index] = proc->subxidStatus; 0.00 : 6b5b71: mov 0x685ed8(%rip),%rax # d3ba50 0.00 : 6b5b78: mov 0x18(%rax),%rax 0.00 : 6b5b7c: mov -0x1c(%rbp),%edx 0.00 : 6b5b7f: movslq %edx,%rdx 0.00 : 6b5b82: add %rdx,%rdx 0.00 : 6b5b85: add %rax,%rdx 0.00 : 6b5b88: mov -0x28(%rbp),%rax 0.00 : 6b5b8c: movzwl 0x40(%rax),%eax 0.00 : 6b5b90: mov %ax,(%rdx) : 257 ProcGlobal->statusFlags[index] = proc->statusFlags; 0.00 : 6b5b93: mov 0x685eb6(%rip),%rax # d3ba50 0.00 : 6b5b9a: mov 0x20(%rax),%rdx 0.00 : 6b5b9e: mov -0x1c(%rbp),%eax 0.00 : 6b5ba1: cltq 0.00 : 6b5ba3: add %rax,%rdx 0.00 : 6b5ba6: mov -0x28(%rbp),%rax 0.00 : 6b5baa: movzbl 0x2c(%rax),%eax 0.00 : 6b5bae: mov %al,(%rdx) : : 267 arrayP->numProcs++; 0.00 : 6b5bb0: mov -0x8(%rbp),%rax 0.00 : 6b5bb4: mov (%rax),%eax 0.00 : 6b5bb6: lea 0x1(%rax),%edx 0.00 : 6b5bb9: mov -0x8(%rbp),%rax 0.00 : 6b5bbd: mov %edx,(%rax) : : 274 /* adjust pgxactoff for all following PGPROCs */ : 275 index++; 0.00 : 6b5bbf: addl $0x1,-0x1c(%rbp) : 277 for (; index < arrayP->numProcs; index++) 0.00 : 6b5bc3: jmp 6b5bf7 : 279 { : 280 int procno = arrayP->pgprocnos[index]; 0.00 : 6b5bc5: mov -0x8(%rbp),%rax 0.00 : 6b5bc9: mov -0x1c(%rbp),%edx 0.00 : 6b5bcc: movslq %edx,%rdx 0.00 : 6b5bcf: add $0x8,%rdx 0.00 : 6b5bd3: mov 0x4(%rax,%rdx,4),%eax 0.00 : 6b5bd7: mov %eax,-0xc(%rbp) : : 288 Assert(procno >= 0 && procno < (arrayP->maxProcs + NUM_AUXILIARY_PROCS)); : 289 Assert(pgxactoffs[procno] == index - 1); : : 291 pgxactoffs[procno] = index; 0.00 : 6b5bda: mov 0x683bcf(%rip),%rax # d397b0 0.00 : 6b5be1: mov -0xc(%rbp),%edx 0.00 : 6b5be4: movslq %edx,%rdx 0.00 : 6b5be7: shl $0x2,%rdx 0.00 : 6b5beb: add %rax,%rdx 0.00 : 6b5bee: mov -0x1c(%rbp),%eax 0.00 : 6b5bf1: mov %eax,(%rdx) : 299 for (; index < arrayP->numProcs; index++) 0.00 : 6b5bf3: addl $0x1,-0x1c(%rbp) 0.00 : 6b5bf7: mov -0x8(%rbp),%rax 0.00 : 6b5bfb: mov (%rax),%eax 0.00 : 6b5bfd: cmp %eax,-0x1c(%rbp) 0.00 : 6b5c00: jl 6b5bc5 : : 306 /* : 307 * Release in reversed acquisition order, to reduce frequency of having to : 308 * wait for XidGenLock while holding ProcArrayLock. : 309 */ : 310 LWLockRelease(XidGenLock); 0.00 : 6b5c02: mov 0x685057(%rip),%rax # d3ac60 0.00 : 6b5c09: add $0x180,%rax 0.00 : 6b5c0f: mov %rax,%rdi 0.00 : 6b5c12: call 6d50fc : 315 LWLockRelease(ProcArrayLock); 0.00 : 6b5c17: mov 0x685042(%rip),%rax # d3ac60 0.00 : 6b5c1e: add $0x200,%rax 0.00 : 6b5c24: mov %rax,%rdi 0.00 : 6b5c27: call 6d50fc : 320 } 0.00 : 6b5c2c: nop 0.00 : 6b5c2d: leave 0.00 : 6b5c2e: ret