Memory buffer alignment

Поиск
Список
Период
Сортировка
От Manfred Spraul
Тема Memory buffer alignment
Дата
Msg-id 3F6A2319.8040203@colorfullife.com
обсуждение исходный текст
Ответы Re: Memory buffer alignment  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

When analyzing the kernel profile from osdl dbt benchmarks, I noticed 
that around 50% of the kernel time is spent in __copy_user_intel.
http://khack.osdl.org/stp/280060/profile/

This function is one of two functions that does the actual memory copy 
from/to kernel space to/from user space.
Unfortunately it's the slower one: Intel cpus have a microcode fastpath 
for memcopies that are 8-byte aligned. This fastpath is around 50% 
faster than the manual copy that is used for "misaligned" (i.e. only 
4-byte aligned) pointers. I don't know enough about other cpus, but I'd 
expect that most cpus prefer well-aligned buffers.
How are the user space buffers allocated?
So far I found buffile.c, but "struct BufFile.buffer" is at offset 32, 
i.e. aligned, although by chance. What is the alignment of the output of 
palloc? Is buffile.c the main code that reads/writes data to disk?

--   Manfred



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 7.4beta2 vs 7.3.3
Следующее
От: Carlos Guzman Alvarez
Дата:
Сообщение: Array Parameters on protocol 3.0