Thanks for v3. The only remaining comment I have is:
This comment seems unnecessary, since refcount is not checked inside
pgstat_free_entry, but earlier.
+ /*
+ * Entry has been dropped with refcount at 0, hence decrement the
+ * entry counter.
+ */
I would just say this,
/* Decrement entry count, if required. */
--
Sami