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

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment
Date: 2022-11-08 02:17:46
Message-ID: CAFBsxsEVjopQk+rZhsBqftgBxSQs31iHvmMETFC7_gDWeXYTxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 8, 2022 at 8:57 AM David Rowley <dgrowleyml(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-11-08 02:20:22 Re: Suppressing useless wakeups in walreceiver
Previous Message David Rowley 2022-11-08 02:01:18 Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment