Memory buffer alignment

From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Memory buffer alignment
Date: 2003-09-18 21:26:49
Message-ID: 3F6A2319.8040203@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2003-09-18 21:37:56 Re: 7.4beta2 vs 7.3.3
Previous Message Tom Lane 2003-09-18 20:24:05 Re: 7.4beta2 vs 7.3.3