[PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Qingqing Zhou
The following patch changes BgWriterCommLock to a spinlock. To confirm to the spinlock coding rules(though not needed since we are in critical section), rewrite the requests array into a circular one, which will reduce the lock time when the bgwriter absorbs the requests. A byproduct-benefit is

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Tom Lane
Qingqing Zhou [EMAIL PROTECTED] writes: The following patch changes BgWriterCommLock to a spinlock. Why is this a good idea? regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives?

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Qingqing Zhou
On Sun, 8 Jan 2006, Tom Lane wrote: Why is this a good idea? In spirit of incremental improvement: (1) The spinlock itself are light weight than the LWLock here and we can reduce the lock contention a little bit in AbsorbFsyncRequests(); (2) Don't need the CRITICAL SECTION in

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Tom Lane
Qingqing Zhou [EMAIL PROTECTED] writes: On Sun, 8 Jan 2006, Tom Lane wrote: Why is this a good idea? In spirit of incremental improvement: (1) The spinlock itself are light weight than the LWLock here and we can reduce the lock contention a little bit in AbsorbFsyncRequests();

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Qingqing Zhou
On Sun, 8 Jan 2006, Tom Lane wrote: (1) The spinlock itself are light weight than the LWLock here and we can reduce the lock contention a little bit in AbsorbFsyncRequests(); Spinlock-based coding is inherently much more fragile than LWLock-based coding. I'm against changing things in

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Tom Lane
Qingqing Zhou [EMAIL PROTECTED] writes: Yeah, only theoretically there is some marginal performance improvements. Maybe you suggest we keep the LWLock but use the circular array part? They're separable issues anyway. Yeah, not related to lock. But I changed algorithm to circular array as

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Qingqing Zhou
On Sun, 8 Jan 2006, Tom Lane wrote: If you want the bgwriter to keep working in the face of an out-of-memory condition in the hashtable, I think you'd have to change the coding so that it takes requests one at a time from the queue. Patched version will issue ERROR instead of PANIC at this

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Tom Lane
Qingqing Zhou [EMAIL PROTECTED] writes: Do you suggest it makes sense that we continue to work on the patch or let it be? I don't see any problem here that urgently needs solving. If we ever see any reports of out-of-memory failures in the bgwriter, then it'll be time to worry about this, but

Re: [PATCHES] Change BgWriterCommLock to spinlock

2006-01-08 Thread Qingqing Zhou
On Sun, 8 Jan 2006, Tom Lane wrote: I don't see any problem here that urgently needs solving. If we ever see any reports of out-of-memory failures in the bgwriter, then it'll be time to worry about this, but I think it quite unlikely that we ever will. (Even if we do, a simpler answer