Re: Spinlocks, yet again: analysis and proposed patches

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Spinlocks, yet again: analysis and proposed patches
Дата
Msg-id 20050914082504.GA29066@svana.org
обсуждение исходный текст
Ответ на Re: Spinlocks, yet again: analysis and proposed patches  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
On Tue, Sep 13, 2005 at 08:14:47PM -0400, Stephen Frost wrote:
> I suppose another option would be to provide seperate packages...  Could
> this be done as a shared library so it's more 'plug-and-play' to switch
> between the two?  I dunno, just trying to think about how to deal with
> this without making it suck terribly bad for me (as a Debian user and
> maintainer).

Note that the Linux kernel has played with moving spinlock code out of
line. Due to the effect of having so many, it ended up that the memory
saved by moving the code out of line actually benefitted overall. An
unconditional call to a function can't be that expensive, surely.

However, it would *have* to be in the same compile unit, no shared
libraries. ELF imposes some overhead for calls in different compile
units, using function pointers won't save you (see Ulrich Drepper
paper on it).

However, to make it flexible you would need a pointer to a function
pointer. Fortunatly these variables won't change often so the function
pointer and the function itself should be in the cache if used often
enough.

Finally, the kernel solves the problem by saying, if you compile for
uniprocessor, optimize the code away, since a lot of the issues don't
apply. My main concern is how you even detect the number of processors
in a portable way...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Andreas Pflug
Дата:
Сообщение: Re: 8.1 system info / admin functions
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: VACUUM VERBOSE 8.1dev