On 13/03/2024 12:18, Thomas Munro wrote:
On Wed, Mar 13, 2024 at 9:57 PM Heikki Linnakangas <hlinn...@iki.fi> wrote:
Here also is a first attempt at improving the memory allocation and
memory layout.
...
+typedef union BufferSlot
+{
+     PGIOAlignedBlock buffer;
+     dlist_node      freelist_node;
+}                    BufferSlot;
+

If you allocated the buffers in one large contiguous chunk, you could
often do one large write() instead of a gathered writev() of multiple
blocks. That should be even better, although I don't know much of a
difference it makes. The above layout wastes a fair amount memory too,
because 'buffer' is I/O aligned.

The patch I posted has an array of buffers with the properties you
describe, so you get a pwrite() (no 'v') sometimes, and a pwritev()
with a small iovcnt when it wraps around:

Oh I missed that it was "union BufferSlot". I thought it was a struct. Never mind then.

--
Heikki Linnakangas
Neon (https://neon.tech)



Reply via email to