mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 08:42:45 +01:00
kernel: Account for system resource size for memory usage
GetTotalPhysicalMemoryAvailableWithoutSystemResource & GetTotalPhysicalMemoryUsedWithoutSystemResource seem to subtract the resource size from the usage.
This commit is contained in:
parent
83e3b77ed7
commit
74ff1db758
1 changed files with 4 additions and 2 deletions
|
@ -132,7 +132,8 @@ std::shared_ptr<ResourceLimit> Process::GetResourceLimit() const {
|
||||||
|
|
||||||
u64 Process::GetTotalPhysicalMemoryAvailable() const {
|
u64 Process::GetTotalPhysicalMemoryAvailable() const {
|
||||||
const u64 capacity{resource_limit->GetCurrentResourceValue(ResourceType::PhysicalMemory) +
|
const u64 capacity{resource_limit->GetCurrentResourceValue(ResourceType::PhysicalMemory) +
|
||||||
page_table->GetTotalHeapSize() + image_size + main_thread_stack_size};
|
page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size +
|
||||||
|
main_thread_stack_size};
|
||||||
|
|
||||||
if (capacity < memory_usage_capacity) {
|
if (capacity < memory_usage_capacity) {
|
||||||
return capacity;
|
return capacity;
|
||||||
|
@ -146,7 +147,8 @@ u64 Process::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 Process::GetTotalPhysicalMemoryUsed() const {
|
u64 Process::GetTotalPhysicalMemoryUsed() const {
|
||||||
return image_size + main_thread_stack_size + page_table->GetTotalHeapSize();
|
return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() +
|
||||||
|
GetSystemResourceSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const {
|
u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const {
|
||||||
|
|
Loading…
Reference in a new issue