vmtouch icon indicating copy to clipboard operation
vmtouch copied to clipboard

Add support for cachestat() syscall

Open oandrew opened this issue 1 year ago • 0 comments

Linux 6.5 added new cachestat() syscall to obtain page cache statistics for a given fd. It is much faster than mincore(), especially on big files. Update vmtouch to use cachestat() when it's available and none of the -t, -e, -v flags are passed. Additionally, cachestat() reports correct numbers even without write permissions on files. (https://lwn.net/Articles/778437/)

On my machine, running vmtouch on directory with:

  • Linux kernel checkout (96962 files, 7Gb total)
Before: 1.2s 
After:  0.6s
  • Large media files (417 files, 139Gb total)
Before: 800ms
After:   13ms

oandrew avatar Oct 02 '24 16:10 oandrew