Idea: Tell compiler palloc() et al return aligned values

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Idea: Tell compiler palloc() et al return aligned values
Date: 2016-10-04 22:39:14
Message-ID: 20161004223914.4v3pkzvga4wdekbj@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Just saw a fair amount of memset/memcpy in a profile, with the symbol
name indicating that the compiler assumes the data is unaligned. After
pondering it for a few moments, that's not too surprising: Even if the
memory is allocated in the same place, the compiler has no way knowing
that palloc et al always return aligned memory.

Seems like a good idea to replace palloc et al with a macro that does
__builtin_assume_aligned(real_palloc(), 8) or such.

Greetings,

Andres Freund

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2016-10-04 23:11:52 Re: Hash tables in dynamic shared memory
Previous Message Andres Freund 2016-10-04 22:22:09 Re: Hash tables in dynamic shared memory