Re: Question on alignment

2019-04-05 Thread Antonin Houska
Tom Lane wrote: > Antonin Houska writes: > > Antonin Houska wrote: > >> Since palloc() only ensures MAXIMUM_ALIGNOF, that wouldn't help here > >> anyway. > > > After some more search I'm not sure about that. The following comment > > indicates that MAXALIGN helps too: > > Well, there is more

Re: Question on alignment

2019-04-01 Thread Tom Lane
Antonin Houska writes: > Antonin Houska wrote: >> Since palloc() only ensures MAXIMUM_ALIGNOF, that wouldn't help here anyway. > After some more search I'm not sure about that. The following comment > indicates that MAXALIGN helps too: Well, there is more than one thing going on here, and more

Re: Question on alignment

2019-04-01 Thread Michael Paquier
On Mon, Apr 01, 2019 at 02:38:30PM +0200, Antonin Houska wrote: > After some more search I'm not sure about that. The following comment > indicates that MAXALIGN helps too: The performance argument is true, now the reason why PGAlignedBlock has been introduced is here: https://www.postgresql.org/m

Re: Question on alignment

2019-04-01 Thread Antonin Houska
Antonin Houska wrote: > Since palloc() only ensures MAXIMUM_ALIGNOF, that wouldn't help here anyway. After some more search I'm not sure about that. The following comment indicates that MAXALIGN helps too: /* * Use this, not "char buf[BLCKSZ]", to declare a field or local variable * holding a

Re: Question on alignment

2019-04-01 Thread Antonin Houska
Heikki Linnakangas wrote: > On 01/04/2019 11:01, Antonin Houska wrote: > > In copydir.c:copy_file() I read > > > > /* Use palloc to ensure we get a maxaligned buffer */ > > buffer = palloc(COPY_BUF_SIZE); > > > > No data type wider than a single byte is used to access the data in the > >

Re: Question on alignment

2019-04-01 Thread Heikki Linnakangas
On 01/04/2019 11:01, Antonin Houska wrote: In copydir.c:copy_file() I read /* Use palloc to ensure we get a maxaligned buffer */ buffer = palloc(COPY_BUF_SIZE); No data type wider than a single byte is used to access the data in the buffer, and neither read() nor write() should

Question on alignment

2019-04-01 Thread Antonin Houska
In copydir.c:copy_file() I read /* Use palloc to ensure we get a maxaligned buffer */ buffer = palloc(COPY_BUF_SIZE); No data type wider than a single byte is used to access the data in the buffer, and neither read() nor write() should require any specific alignment. Can someone p