20 #include "pedigree/kernel/process/MemoryPressureKiller.h" 21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/Subsystem.h" 23 #include "pedigree/kernel/process/Process.h" 24 #include "pedigree/kernel/process/Scheduler.h" 25 #include "pedigree/kernel/processor/types.h" 27 static size_t mb(
size_t pages)
29 return (pages * 0x1000) / 0x100000;
40 if (!pProcess->getSubsystem())
43 if (!pCandidateProcess)
44 pCandidateProcess = pProcess;
47 if (pProcess->getPhysicalPageCount() >
48 pCandidateProcess->getPhysicalPageCount())
50 pCandidateProcess = pProcess;
55 if (!pCandidateProcess)
59 "MemoryPressureProcessKiller will kill pid=" 62 "virt=" <<
Dec << mb(pCandidateProcess->getVirtualPageCount())
63 <<
"m phys=" << mb(pCandidateProcess->getPhysicalPageCount())
64 <<
"m shared=" << mb(pCandidateProcess->getSharedPageCount())
69 Subsystem *pSubsystem = pCandidateProcess->getSubsystem();
70 pSubsystem->
kill(Subsystem::Unknown, pCandidateProcess->
getThread(0));
static Scheduler & instance()
Process * getProcess(size_t n)
Thread * getThread(size_t n)
virtual bool kill(KillReason killReason, Thread *pThread=0)=0