Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> Current HaveNFreeProcs() iterates through the entire freeProcs list
> (while holding ProcStructLock) just to determine if there's a small
> number (superuser_reserved_connections) of free slots available.
I think you misread it. Note the "n > 0" part of the while condition.
regards, tom lane