Re: [PATCH] mremap: properly flush TLB before releasing the page

From: Linus Torvalds
Date: Fri Nov 02 2018 - 12:05:42 EST


On Fri, Nov 2, 2018 at 8:25 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
>
> I wounder if it would be cheaper to fix this by taking i_mmap_lock_write()
> unconditionally in mremap() path rather than do a lot of flushing.

That wouldn't help. Think anonymous pages and try_to_free() rmap walk.
So then I think we'd have to take the anonvma lock or something.

And it's not like we are likely to even do any more flushes, really.
We don't flush for each page, only for each page table. So every 512
pages or so.

Linus