[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <cover.1617831474.git.dxu@dxuuu.xyz>
Date: Wed, 7 Apr 2021 14:46:10 -0700
From: Daniel Xu <dxu@...uu.xyz>
To: bpf@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org
Cc: Daniel Xu <dxu@...uu.xyz>, linux-kernel@...r.kernel.org,
kernel-team@...com, jolsa@...nel.org, hannes@...xchg.org,
yhs@...com
Subject: [RFC bpf-next 0/1] bpf: Add page cache iterator
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.
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.
NOTES:
* This patch compiles and (maybe) works -- totally not fully tested
or in a final state
* I'm sending this early RFC to get comments on the general approach.
I chatted w/ Johannes a little bit and it seems like the best way to
do this is through superblock -> inode -> address_space iteration
rather than going from numa node -> LRU iteration
* I'll most likely add a page_hash() helper (or something) that hashes
a page so that userspace can more easily tell which pages are
duplicate
Daniel Xu (1):
bpf: Introduce iter_pagecache
kernel/bpf/Makefile | 2 +-
kernel/bpf/pagecache_iter.c | 293 ++++++++++++++++++++++++++++++++++++
2 files changed, 294 insertions(+), 1 deletion(-)
create mode 100644 kernel/bpf/pagecache_iter.c
--
2.26.3
Powered by blists - more mailing lists