Re: Spinlocks, yet again: analysis and proposed patches

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Spinlocks, yet again: analysis and proposed patches
Дата
Msg-id 87d5ncm7ia.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Spinlocks, yet again: analysis and proposed patches  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:

> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
> > I'm starting to think that we might have to succumb to having a compile
> > option "optimize for multiprocessor" or "optimize for single processor".
> > It's pretty hard to see how we'd alter a data structure decision like
> > this on the fly.
> 
> I'd really hate to see this happen.  

I suspect you're thinking too hard about this. It's not like some LWLocks
would need SMP spinlocks and others uniprocessor locks. And it's not like it's
going to change dynamically.

Wouldn't it just be a couple:

if (multiprocessor) { complex version
} else { simple version
}


Ugly to be sure but it's not going to spread to other areas of the source base
and you know the if statement isn't going to be growing any more arms. 

It's no uglier than doing the same thing with an #ifdef anyways.



If you really really want to have two versions and you think using function
pointers would impose too big a performance penalty you could play linker
games. But that way lies madness.


-- 
greg



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: Spinlocks, yet again: analysis and proposed patches
Следующее
От: "Michael Paesold"
Дата:
Сообщение: Re: Spinlocks, yet again: analysis and proposed patches