kern: General system stability improvements to enhance the user's experience.

This commit is contained in:
Michael Scire 2020-07-24 20:44:15 -07:00 committed by SciresM
parent 2ad9927a88
commit 583899ede3
5 changed files with 20 additions and 4 deletions

View file

@ -105,6 +105,9 @@ namespace ams::kern {
/* Clear our tracking variables. */
this->system_resource_address = Null<KVirtualAddress>;
this->system_resource_num_pages = 0;
/* Finalize optimized memory. If memory wasn't optimized, this is a no-op. */
Kernel::GetMemoryManager().FinalizeOptimizedMemory(this->GetId(), this->memory_pool);
}
/* Release memory to the resource limit. */
@ -359,7 +362,7 @@ namespace ams::kern {
MESOSPHERE_ABORT_UNLESS(this->process_id <= ProcessIdMax);
/* If we should optimize memory allocations, do so. */
if (this->system_resource_address != Null<KVirtualAddress>) {
if (this->system_resource_address != Null<KVirtualAddress> && (params.flags & ams::svc::CreateProcessFlag_OptimizeMemoryAllocation) != 0) {
R_TRY(Kernel::GetMemoryManager().InitializeOptimizedMemory(this->process_id, pool));
}