Re: [PATCH v7 01/11] mm/mremap: Fix race between MOVE_PMD mremap and pageout

2021-06-08 Thread Hugh Dickins
On Tue, 8 Jun 2021, Aneesh Kumar K.V wrote: > > mm/mremap: hold the rmap lock in write mode when moving page table > entries. > > To avoid a race between rmap walk and mremap, mremap does > take_rmap_locks(). > The lock was taken to ensure that rmap walk don't miss a page table

Re: [PATCH v7 01/11] mm/mremap: Fix race between MOVE_PMD mremap and pageout

2021-06-08 Thread Kirill A. Shutemov
On Tue, Jun 08, 2021 at 04:47:19PM +0530, Aneesh Kumar K.V wrote: > On 6/8/21 3:12 PM, Kirill A. Shutemov wrote: > > On Tue, Jun 08, 2021 at 01:22:23PM +0530, Aneesh Kumar K.V wrote: > > > > > > Hi Hugh, > > > > > > Hugh Dickins writes: > > > > > > > On Mon, 7 Jun 2021, Aneesh Kumar K.V wrote:

Re: [PATCH v7 01/11] mm/mremap: Fix race between MOVE_PMD mremap and pageout

2021-06-08 Thread Aneesh Kumar K.V
On 6/8/21 3:12 PM, Kirill A. Shutemov wrote: On Tue, Jun 08, 2021 at 01:22:23PM +0530, Aneesh Kumar K.V wrote: Hi Hugh, Hugh Dickins writes: On Mon, 7 Jun 2021, Aneesh Kumar K.V wrote: CPU 1 CPU 2 CPU 3 mremap(old_addr, new_addr

Re: [PATCH v7 01/11] mm/mremap: Fix race between MOVE_PMD mremap and pageout

2021-06-08 Thread Kirill A. Shutemov
On Tue, Jun 08, 2021 at 01:22:23PM +0530, Aneesh Kumar K.V wrote: > > Hi Hugh, > > Hugh Dickins writes: > > > On Mon, 7 Jun 2021, Aneesh Kumar K.V wrote: > > > >> CPU 1 CPU 2 > >> CPU 3 > >> > >> mremap(old_addr, new_addr) pa

Re: [PATCH v7 01/11] mm/mremap: Fix race between MOVE_PMD mremap and pageout

2021-06-08 Thread Aneesh Kumar K.V
Hi Hugh, Hugh Dickins writes: > On Mon, 7 Jun 2021, Aneesh Kumar K.V wrote: > >> CPU 1CPU 2 >> CPU 3 >> >> mremap(old_addr, new_addr) page_shrinker/try_to_unmap_one >> >> mmap_write_lock_killable() >> >>

Re: [PATCH v7 01/11] mm/mremap: Fix race between MOVE_PMD mremap and pageout

2021-06-07 Thread Hugh Dickins
On Mon, 7 Jun 2021, Aneesh Kumar K.V wrote: > CPU 1 CPU 2 CPU 3 > > mremap(old_addr, new_addr) page_shrinker/try_to_unmap_one > > mmap_write_lock_killable() > > addr = old_addr >

[PATCH v7 01/11] mm/mremap: Fix race between MOVE_PMD mremap and pageout

2021-06-06 Thread Aneesh Kumar K.V
CPU 1 CPU 2 CPU 3 mremap(old_addr, new_addr) page_shrinker/try_to_unmap_one mmap_write_lock_killable() addr = old_addr lock(pte_ptl) lock(pmd_ptl) pmd = *old_pmd pmd_c