mirror of
https://github.com/Lizonghang/prima.cpp.git
synced 2025-09-10 20:24:34 +00:00
fix std::max val type
This commit is contained in:
parent
a11e0dd0fa
commit
4104eb5b7a
1 changed files with 2 additions and 2 deletions
|
@ -558,7 +558,7 @@ static uint64_t device_cgroup_physical_memory(bool available) {
|
|||
inactive_file = stats["inactive_file"];
|
||||
}
|
||||
|
||||
uint64_t available_memory = std::max(mem_max - mem_current, 0);
|
||||
uint64_t available_memory = mem_max - mem_current > 0 ? mem_max - mem_current : 0;
|
||||
available_memory += slab_reclaimable;
|
||||
available_memory += inactive_file;
|
||||
return available_memory;
|
||||
|
@ -566,7 +566,7 @@ static uint64_t device_cgroup_physical_memory(bool available) {
|
|||
LOG_WRN("Using cgroup v1, the available memory could be error, will be addressed later\n");
|
||||
uint64_t mem_limit = read_value_from_file("/sys/fs/cgroup/memory/memory.limit_in_bytes");
|
||||
uint64_t mem_usage = read_value_from_file("/sys/fs/cgroup/memory/memory.usage_in_bytes");
|
||||
return std::max(mem_limit - mem_usage, 0);
|
||||
return mem_limit - mem_usage > 0 ? mem_limit - mem_usage : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue