Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment - Mailing list pgsql-hackers

From John Naylor
Subject Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment
Date
Msg-id CAFBsxsEVjopQk+rZhsBqftgBxSQs31iHvmMETFC7_gDWeXYTxQ@mail.gmail.com
Whole thread Raw
In response to Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment
List pgsql-hackers

On Tue, Nov 8, 2022 at 8:57 AM David Rowley <dgrowleyml@gmail.com> wrote:
> Is there anything we could align to CPU cacheline size that would
> speed something up?

InitCatCache() already has this, which could benefit from simpler notation.

/*
 * Allocate a new cache structure, aligning to a cacheline boundary
 *
 * Note: we rely on zeroing to initialize all the dlist headers correctly
 */
sz = sizeof(CatCache) + PG_CACHE_LINE_SIZE;
cp = (CatCache *) CACHELINEALIGN(palloc0(sz));

--
John Naylor
EDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment
Next
From: Thomas Munro
Date:
Subject: Re: Suppressing useless wakeups in walreceiver