Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment
От | David Rowley |
---|---|
Тема | Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment |
Дата | |
Msg-id | CAApHDvpfm7SnRLgvRZj4QEHYEQGeZ=oUeBbcJ9RNHaErPR6eWg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment (David Rowley <dgrowleyml@gmail.com>) |
Список | pgsql-hackers |
On Tue, 8 Nov 2022 at 14:57, David Rowley <dgrowleyml@gmail.com> 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. Thinking about that a bit more, if we keep the repalloc support then we can't do this as if we happen to get the right alignment by chance during the palloc_aligned, then if we don't have the redirection MemoryChunk, then we've no way to ensure we keep the alignment after a repalloc. David
В списке pgsql-hackers по дате отправления: