Re: Wierd context-switching issue on Xeon patch for 7.4.1
От | Bruce Momjian |
---|---|
Тема | Re: Wierd context-switching issue on Xeon patch for 7.4.1 |
Дата | |
Msg-id | 200404220456.i3M4uFv04710@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Wierd context-switching issue on Xeon patch for 7.4.1 (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Wierd context-switching issue on Xeon patch for 7.4.1
|
Список | pgsql-performance |
Tom Lane wrote: > Dave Cramer <pg@fastcrypt.com> writes: > > I tried increasing the NUM_SPINS to 1000 and it works better. > > Doesn't surprise me. The value of 100 is about right on the assumption > that the spinlock instruction per se is not too much more expensive than > any other instruction. What I was seeing from oprofile suggested that > the spinlock instruction cost about 100x more than an ordinary > instruction :-( ... so maybe 200 or so would be good on a Xeon. > > > This is certainly heading in the right direction ? Although it looks > > like it is highly dependent on the system you are running on. > > Yeah. I don't know a reasonable way to tune this number automatically > for particular systems ... but at the very least we'd need to find a way > to distinguish uniprocessor from multiprocessor, because on a > uniprocessor the optimal value is surely 1. Have you looked at the code pointed to by our TODO item: * Add code to detect an SMP machine and handle spinlocks accordingly from distributted.net, http://www1.distributed.net/source, in client/common/cpucheck.cpp For BSDOS it has: #if (CLIENT_OS == OS_FREEBSD) || (CLIENT_OS == OS_BSDOS) || \ (CLIENT_OS == OS_OPENBSD) || (CLIENT_OS == OS_NETBSD) { /* comment out if inappropriate for your *bsd - cyp (25/may/1999) */ int ncpus; size_t len = sizeof(ncpus); int mib[2]; mib[0] = CTL_HW; mib[1] = HW_NCPU; if (sysctl( &mib[0], 2, &ncpus, &len, NULL, 0 ) == 0) //if (sysctlbyname("hw.ncpu", &ncpus, &len, NULL, 0 ) == 0) cpucount = ncpus; } and I can confirm that on my computer it works: hw.ncpu = 2 -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
В списке pgsql-performance по дате отправления: