Am currently trying to create an efficient dynamic memory allocation for virtual machines in virtualized environment using QEMU/KVM.

My final problem is when the guest virtual machine almost run out of memory it will use OOM Killer and prevent anything working without enough memory. but what am doing is that when the machine is almost running out of memory my algorithm will take some free memory from other guest virtual machine and allocate it to that the machine that need it.

so i have disable swap, ksm is not running and final thing is that OOM killer is killing other programs.

i have read and search for disabling OOM killer and i found its bad idea to disable it.

So now asking here is there a way i can delay the OOM Killer for 1 or 2 second and let the process running because my algorithm will allocate memory for the machine already.

or can the process running and allocate memory even if there is no memory so my algorithm will allocate memory for that machine.

1 Answer 1


I'm not sure if I understood your question correctly but you probably want to use memory cgroup which can limit the memory usage and stop all processes in that group in case it's about to go out of memory. Then you can run other processes (not in that group) that decide what to do and possibly increase the memory limit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.