Re: [PATCH] mm/mremap: Don't account pages in vma_to_resize()

From: Dmitry Safonov
Date: Wed Jul 21 2021 - 09:09:21 EST

On 7/21/21 1:49 PM, Dmitry Safonov wrote:
> All this vm_unacct_memory(charged) dance seems to complicate the life
> without a good reason. Furthermore, it seems not always done right on
> error-pathes in mremap_to().
> And worse than that: this `charged' difference is sometimes
> double-accounted for growing MREMAP_DONTUNMAP mremap()s in move_vma():
> : if (security_vm_enough_memory_mm(mm, new_len >> PAGE_SHIFT))
> Let's not do this.
> Account memory in mremap() fast-path for growing VMAs or in move_vma()
> for actually moving things.

And this one is also wrong: the diff for growing vma should be accounted
Sending v2...