--- a/mm/mremap.c~mm-mremap-account-memory-on-do_munmap-failure +++ a/mm/mremap.c @@ -600,7 +600,8 @@ static unsigned long move_vma(struct vm_ if (do_munmap(mm, old_addr, old_len, uf_unmap) < 0) { /* OOM: unable to split vma, just get accounts right */ - vm_unacct_memory(excess >> PAGE_SHIFT); + if (vm_flags & VM_ACCOUNT) + vm_acct_memory(new_len >> PAGE_SHIFT); excess = 0; }