kernel: Start clearing caches when free memory is lower than 1MiB
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This is done to avoid returning ENOMEM errors when cache memory can still be reclaimed.
This commit is contained in:
parent
b370a99aa6
commit
b42497e05e
@ -157,6 +157,13 @@ namespace MemoryManager
|
|||||||
used_mem += ARCH_PAGE_SIZE;
|
used_mem += ARCH_PAGE_SIZE;
|
||||||
free_mem -= ARCH_PAGE_SIZE;
|
free_mem -= ARCH_PAGE_SIZE;
|
||||||
|
|
||||||
|
if (free_mem < 1024 * 1024)
|
||||||
|
{
|
||||||
|
// Less than 1 MiB of free memory! Let's start clearing caches...
|
||||||
|
kwarnln("Less than 1 MiB of free memory, clearing caches to try to gain extra memory");
|
||||||
|
Scheduler::signal_oom_thread();
|
||||||
|
}
|
||||||
|
|
||||||
return index * ARCH_PAGE_SIZE;
|
return index * ARCH_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user