Skip to content

Add support for cachestat() syscall#111

Open
oandrew wants to merge 1 commit intohoytech:masterfrom
oandrew:add-cachestat-support
Open

Add support for cachestat() syscall#111
oandrew wants to merge 1 commit intohoytech:masterfrom
oandrew:add-cachestat-support

Conversation

@oandrew
Copy link

@oandrew oandrew commented Oct 2, 2024

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
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant