Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment
Дата
Msg-id 20221114221143.sadq6mat3kf3oeal@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers
Hi,

On 2022-11-08 14:57:35 +1300, David Rowley wrote:
> On Tue, 8 Nov 2022 at 05:24, Andres Freund <andres@anarazel.de> wrote:
> > Should we handle the case where we get a suitably aligned pointer from
> > MemoryContextAllocExtended() differently?
> 
> Maybe it would be worth the extra check. I'm trying to imagine future
> use cases.  Maybe if someone wanted to ensure that we're aligned to
> CPU cache line boundaries then the chances of the pointer already
> being aligned to 64 bytes is decent enough.  The problem is it that
> it's too late to save any memory, it just saves a bit of boxing and
> unboxing of the redirect headers.

Couldn't we reduce the amount of over-allocation by a small amount by special
casing the already-aligned case? That's not going to be relevant for page size
aligne allocations, but for smaller alignment values it could matter.

Greetings,

Andres Freund



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: HOT chain validation in verify_heapam()
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: HOT chain validation in verify_heapam()