>. In any case, the "futex patch"
>uses the Linux 2.6 futex API to implement PostgreSQL spinlocks.
Has anyone tried to replace the whole lwlock implementation with
pthread_rwlock? At least for Linux with recent glibcs, pthread_rwlock is
implemented with futexes, i.e. we would get a fast lock handling without
os specific hacks. Perhaps other os contain user space pthread locks, too.
Attached is an old patch. I tested it on an uniprocessor system a year
ago and it didn't provide much difference, but perhaps the scalability
is better. You'll have to add -lpthread to the library list for linking.
Regarding Neil's patch:
>! * XXX: is there a more efficient way to write this? Perhaps using
>! * decl...?
>! static __inline__ slock_t
>! atomic_dec(volatile slock_t *ptr)
>! slock_t prev = -1;
>! __asm__ __volatile__(
>! " lock \n"
>! " xadd %0,%1 \n"
>! :"m"(*ptr), "0"(prev)
>! :"memory", "cc");
>! return prev;
xadd is not supported by original 80386 cpus, it was added for 80486
cpus. There is no instruction in the 80386 cpu that allows to atomically
decrement and retrieve the old value of an integer. The only option are
atomic_dec_test_zero or atomic_dec_test_negative - that can be
implemented by looking at the sign/zero flag. Depending on what you want
this may be enough. Or make the futex code conditional for > 80386 cpus.
pgsql-performance by date
|Next:||From: simon||Date: 2004-10-17 19:40:01|
|Subject: Re: Getting rid of AtEOXact Buffers (was Re: [Testperf-general] Re: [PERFORM] First set of OSDL Shared Memscalability results, some wierdness ...)|
|Previous:||From: Josh Berkus||Date: 2004-10-16 21:36:45|
|Subject: Re: Getting rid of AtEOXact_Buffers (was Re: [Testperf-general] Re: [PERFORM] First set of OSDL Shared Memscalability results, some wierdness ...)|