Re: [RFC bpf-next 0/1] bpf: Add page cache iterator
From: Shakeel Butt
Date: Thu Apr 08 2021 - 17:34:01 EST
On Wed, Apr 7, 2021 at 2:47 PM Daniel Xu <dxu@xxxxxxxxx> wrote:
>
> There currently does not exist a way to answer the question: "What is in
> the page cache?". There are various heuristics and counters but nothing
> that can tell you anything like:
>
> * 3M from /home/dxu/foo.txt
> * 5K from ...
> * etc.
>
So, you need the list of inodes for a filesystem that are in memory.
With that list, you can open, map and do mincore on them?
I don't know of a way to get that inode list.
> The answer to the question is particularly useful in the stacked
> container world. Stacked containers implies multiple containers are run
> on the same physical host. Memory is precious resource on some (if not
> most) of these systems. On these systems, it's useful to know how much
> duplicated data is in the page cache. Once you know the answer, you can
> do something about it. One possible technique would be bind mount common
> items from the root host into each container.
>
Oh you want to share page cache between different containers/jobs?
That would complicate charging.