[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180711115824.GN20050@dhcp22.suse.cz>
Date: Wed, 11 Jul 2018 13:58:24 +0200
From: Michal Hocko <mhocko@...nel.org>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: Yang Shi <yang.shi@...ux.alibaba.com>, willy@...radead.org,
ldufour@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC v4 0/3] mm: zap pages with read mmap_sem in munmap for
large mapping
On Wed 11-07-18 14:10:52, Kirill A. Shutemov wrote:
[...]
> It's okay. I have another suggestion that also doesn't require VM_DEAD
> trick too :)
>
> 1. Take mmap_sem for write;
> 2. Adjust VMA layout (split/remove). After the step all memory we try to
> unmap is outside any VMA.
> 3. Downgrade mmap_sem to read.
> 4. Zap the page range.
> 5. Drop mmap_sem.
>
> I believe it should be safe.
>
> The pages in the range cannot be re-faulted after step 3 as find_vma()
> will not see the corresponding VMA and deliver SIGSEGV.
>
> New VMAs cannot be created in the range before step 5 since we hold the
> semaphore at least for read the whole time.
>
> Do you see problem in this approach?
Yes this seems to be safe. At least from the first glance.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists