On Jul 23, 2025, at 16:33, Bertrand Drouvot <bertranddrouvot...@gmail.com> 
wrote:
> Maybe we could use a flag, say:
> 
> #define PGSTAT_PENDING_IO     (1 << 0)
> #define PGSTAT_PENDING_WAL    (1 << 1)
> #define PGSTAT_PENDING_SLRU   (1 << 2)
> 
> and check for a pgstat_pending_mask in pgstat_report_stat() instead?
> 
> They would need to set pgstat_pending_mask accordingly when they flush, have
> pending stats though.

The point is just to say to the report path to move further if at least one of 
the fixed stats kinds has something to flush, then let the loop do its work 
across all the stats kinds if they have a flush callback, so we don’t really 
need to mix multiple numbers; we could just have a single boolean flag that any 
fixed-sized stats kinds can set to let the reporting know that some activity 
has happened. This would mean that custom fixed-sized kinds would need to 
interact with this flag as well, but that makes the fast-exit path dirty cheap 
with or without custom stats kinds.
--
Michael




Reply via email to