Revert "oom: remove unnecessary code and cleanup"

This reverts commit f7ae1d439cde0f4591a875ebc8efa47b6ed45b9f.