Skip to content

Commit

Permalink
memory: use peak in max_usage_in_bytes
Browse files Browse the repository at this point in the history
Kernel 5.19 introduces `memory.peak` and kernel 6.5 introduces
`memory.swap.peak` to expose the memory and swap usage watermark.
This change use these values to fill `max_usage_in_bytes`.

Signed-off-by: HeRaNO <[email protected]>
  • Loading branch information
HeRaNO committed Sep 12, 2023
1 parent 8d29c19 commit be83716
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,10 @@ impl MemController {
.open_path("memory.current", false)
.and_then(read_u64_from)
.unwrap_or(0),
max_usage_in_bytes: 0,
max_usage_in_bytes: self
.open_path("memory.peak", false)
.and_then(read_u64_from)
.unwrap_or(0),
move_charge_at_immigrate: 0,
numa_stat: NumaStat::default(),
oom_control: OomControl::default(),
Expand Down Expand Up @@ -736,7 +739,10 @@ impl MemController {
.open_path("memory.swap.current", false)
.and_then(read_u64_from)
.unwrap_or(0),
max_usage_in_bytes: 0,
max_usage_in_bytes: self
.open_path("memory.swap.peak", false)
.and_then(read_u64_from)
.unwrap_or(0),
}
}

Expand Down

0 comments on commit be83716

Please sign in to comment.