Re: Linux likely() unlikely() for PostgreSQL

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Linux likely() unlikely() for PostgreSQL
Date: 2024-07-01 02:22:57
Message-ID: CAApHDvpq3-A1YzL6JnRKF0woOAoJXJ8U2S_R2Ysikx_Vw9QfqA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 1 Jul 2024 at 14:08, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>
> On Sun, Jun 30, 2024 at 11:23 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > if (trouble)
> > ereport(ERROR, ...);
> >
> > could be interpreted as
> >
> > if (unlikely(trouble))
> > ereport(ERROR, ...);
> >
> > But I surely don't want to make thousands of such changes manually.
> > And it's possible that smart compilers already realize this, using
> > a heuristic that any path that ends in pg_unreachable() must be
> > unlikely. Is there a way to encourage compilers to believe that?
>
> Isn't that what commit 913ec71d68 did, by adding a call to
> pg_attribute_cold to report?

Yes.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2024-07-01 02:33:42 Re: speed up a logical replica setup
Previous Message Peter Geoghegan 2024-07-01 02:07:40 Re: Linux likely() unlikely() for PostgreSQL