alexgolec
alexgolec

Reputation: 28272

Is there a way to check how much of a file is present in the disk page cache?

I want to see how many blocks of a file are being stored in the kernel's disk page cache. Is there any interface I can look into to check this out? Perhaps something in /proc?

Upvotes: 3

Views: 104

Answers (2)

metdos
metdos

Reputation: 13939

You can use fincore. It is pretty good.

Upvotes: 0

mpe
mpe

Reputation: 2730

As far as I know there is nothing like that in /proc. The overhead of tracking that information and exposing it via /proc would likely be prohibitive.

As Damon suggested your best bet is mmap()'ing the file and using mincore().

Update: I coded up the mincore() idea and it seems to work as expected.

Upvotes: 2

Related Questions