]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm: add vmstat for kernel_file pages
authorBoris Burkov <boris@bur.io>
Thu, 21 Aug 2025 21:55:36 +0000 (14:55 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 13 Sep 2025 23:55:20 +0000 (16:55 -0700)
commite3a9ac4e866ea746475b4026819a8c08ec1142e6
tree56ebc8ed1f9d68fbe783b5a907a45b9cd7977b27
parentcf1dec76ba8a00b20e51d205f3c9f5c45bc96df2
mm: add vmstat for kernel_file pages

Kernel file pages are tricky to track because they are indistinguishable
from files whose usage is accounted to the root cgroup.

To maintain good accounting, introduce a vmstat counter tracking kernel
file pages.

Confirmed that these work as expected at a high level by mounting a btrfs
using AS_KERNEL_FILE for metadata pages, and seeing the counter rise with
fs usage then go back to a minimal level after drop_caches and finally
down to 0 after unmounting the fs.

Link: https://lkml.kernel.org/r/08ff633e3a005ed5f7691bfd9f58a5df8e474339.1755812945.git.boris@bur.io
Signed-off-by: Boris Burkov <boris@bur.io>
Suggested-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Tested-by: syzbot@syzkaller.appspotmail.com
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Qu Wenruo <wqu@suse.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mmzone.h
mm/filemap.c
mm/vmstat.c