Re: Making wait events a bit more efficient

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>, Robert Haas <robertmhaas@gmail.com>
Date: 2021-04-02T20:10:11Z
Lists: pgsql-hackers
Hi,

On 2021-04-02 13:06:35 -0700, Zhihong Yu wrote:
> +extern PGDLLIMPORT uint32 *my_wait_event_info;
> 
> It seems volatile should be added to the above declaration. Since later:
> 
> +   *(volatile uint32 *) my_wait_event_info = wait_event_info;

Why? We really just want to make the store volatile, nothing else. I
think it's much better to annotate that we want individual stores to
happen regardless of compiler optimizations, rather than all
interactions with a variable.

Greetings,

Andres Freund



Commits

  1. Improve efficiency of wait event reporting, remove proc.h dependency.

  2. Do not rely on pgstat.h to indirectly include storage/ headers.