Linux 6.5 Brings New "cachestat" Syscall For Querying Page Cache Stats Of A File
A new system call found in Linux 6.5 is "cachestat" that allows user-space to query page cache statistics for a file in order to make more informed decisions.
There already is the "mincore" system call for determining whether pages are resident in memory while cachestat is allowing for querying of more page cache statistics and aims to provide greater scalability. The cachestat system call will report the number of cached pages / dirty pages / pages marked for writeback / evicted pages / recently evicted pages. The cachestat system call patches have gone through many revisions while finally were picked up last week for the Linux 6.5 kernel.
A number of possible user-space use-cases were previously outlined in the former patch series on the kernel mailing list:
The cachestat system call was merged as part of the MM updates for Linux 6.5.
There already is the "mincore" system call for determining whether pages are resident in memory while cachestat is allowing for querying of more page cache statistics and aims to provide greater scalability. The cachestat system call will report the number of cached pages / dirty pages / pages marked for writeback / evicted pages / recently evicted pages. The cachestat system call patches have gone through many revisions while finally were picked up last week for the Linux 6.5 kernel.
A number of possible user-space use-cases were previously outlined in the former patch series on the kernel mailing list:
* Allowing database to decide whether to perform an index scan or direct table queries based on the in-memory cache state of the index.
* Visibility into the writeback algorithm, for performance issues diagnostic.
* Workload-aware writeback pacing: estimating IO fulfilled by page cache (and IO to be done) within a range of a file, allowing for more frequent syncing when and where there is IO capacity, and batching when there is not.
* Computing memory usage of large files/directory trees, analogous to the du tool for disk usage.
The cachestat system call was merged as part of the MM updates for Linux 6.5.
1 Comment