Hi,
I was testing the index prefetch and streamIO patches and I added
cachestat() syscall to get a better view of the prefetching.
It's a new linux syscall, it requires 6.5, it provides numerous
interesting information from the VM for the range of pages examined.
It's way way faster than the old mincore() and provides much more
valuable information:
uint64 nr_cache; /* Number of cached pages */
uint64 nr_dirty; /* Number of dirty pages */
uint64 nr_writeback; /* Number of pages marked for writeback. */
uint64 nr_evicted; /* Number of pages evicted from the cache. */
/*
* Number of recently evicted pages. A page is recently evicted if its
* last eviction was recent enough that its reentry to the cache would
* indicate that it is actively being used by the system, and that there
* is memory pressure on the system.
*/
uint64 nr_recently_evicted;
While here I also added some quick tweaks to suspend prefetching on
memory pressure.
It's working but I have absolutely not checked the performance impact of
my additions.
Sharing here for others to tests and adding in CF in case there is
interest to go further in this direction.
---
Cédric Villemain +33 (0)6 20 30 22 52
https://Data-Bene.io
PostgreSQL Expertise, Support, Training, R&D