Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new /proc/meminfo fields. #238

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/meminfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ pub struct Meminfo {
///
/// (since Linux 2.6.18)
pub page_tables: Option<u64>,
/// Amount of memory allocated for seconary page tables. This currently includes KVM mmu
/// allocations on x86 and arm64.
///
/// (since Linux 6.1)
pub secondary_page_tables: Option<u64>,
/// [To be documented.]
///
/// (CONFIG_QUICKLIST is required. Since Linux 2.6.27)
Expand Down Expand Up @@ -277,6 +282,16 @@ pub struct Meminfo {
///
/// (CONFIG_TRANSPARENT_HUGEPAGE is required. Since Linux 5.4)
pub file_huge_pages: Option<u64>,

/// Memory consumed by the zswap backend (compressed size).
///
/// (CONFIG_ZSWAP is required. Since Linux 5.19)
pub z_swap: Option<u64>,

/// Amount of anonymous memory stored in zswap (original size).
///
/// (CONFIG_ZSWAP is required. Since Linux 5.19)
pub z_swapped: Option<u64>,
}

impl Meminfo {
Expand Down Expand Up @@ -351,6 +366,7 @@ impl Meminfo {
s_unreclaim: map.remove("SUnreclaim"),
kernel_stack: map.remove("KernelStack"),
page_tables: map.remove("PageTables"),
secondary_page_tables: map.remove("SecPageTables"),
quicklists: map.remove("Quicklists"),
nfs_unstable: map.remove("NFS_Unstable"),
bounce: map.remove("Bounce"),
Expand Down Expand Up @@ -380,6 +396,8 @@ impl Meminfo {
hugetlb: map.remove("Hugetlb"),
file_pmd_mapped: map.remove("FilePmdMapped"),
file_huge_pages: map.remove("FileHugePages"),
z_swap: map.remove("Zswap"),
z_swapped: map.remove("Zswapped"),
};

if cfg!(test) {
Expand Down