Re: Keep elog(ERROR) and ereport(ERROR) calls in the cold path

Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-10T14:02:14Z
Lists: pgsql-hackers
On 2020-09-06 02:24, David Rowley wrote:
>> I would add DEBUG1 back into the conditional, like
>>
>> if (__builtin_constant_p(elevel) && ((elevel) >= ERROR || (elevel) <=
>> DEBUG1) ? \
> 
> hmm, but surely we don't want to move all code that's in the same
> branch as an elog(DEBUG1) call into a cold area.

Yeah, nevermind that.

> The v3 patch just put an unlikely() around the errstart() call if the
> level was <= DEBUG1.  That just to move the code that's inside the if
> (errstart(...)) in the macro into a cold area.

That could be useful.  Depends on how much effect it has.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Commits

  1. Stop gap fix for __attribute__((cold)) compiler bug in MinGW 8.1

  2. Tidy up definitions of pg_attribute_hot and pg_attribute_cold

  3. Fix unportable usage of __has_attribute

  4. Improve compiler code layout in elog/ereport ERROR calls

  5. Define pg_attribute_cold and pg_attribute_hot macros