mm: memory fixes and tweaks