Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Dave Hansen
On 08/22/2018 02:56 PM, owner-linux...@kvack.org wrote: > > > On 8/22/18 2:42 PM, Dave Hansen wrote: >> On 08/22/2018 02:10 PM, Kirill A. Shutemov wrote: For x86, mpx_notify_unmap() looks finally zap the VM_MPX vmas in bound table range with zap_page_range() and doesn't update vm

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Dave Hansen
On 08/22/2018 02:56 PM, owner-linux...@kvack.org wrote: > > > On 8/22/18 2:42 PM, Dave Hansen wrote: >> On 08/22/2018 02:10 PM, Kirill A. Shutemov wrote: For x86, mpx_notify_unmap() looks finally zap the VM_MPX vmas in bound table range with zap_page_range() and doesn't update vm

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Yang Shi
On 8/22/18 2:42 PM, Dave Hansen wrote: On 08/22/2018 02:10 PM, Kirill A. Shutemov wrote: For x86, mpx_notify_unmap() looks finally zap the VM_MPX vmas in bound table range with zap_page_range() and doesn't update vm flags, so it sounds ok to me since vmas have been detached, nobody can find

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Yang Shi
On 8/22/18 2:42 PM, Dave Hansen wrote: On 08/22/2018 02:10 PM, Kirill A. Shutemov wrote: For x86, mpx_notify_unmap() looks finally zap the VM_MPX vmas in bound table range with zap_page_range() and doesn't update vm flags, so it sounds ok to me since vmas have been detached, nobody can find

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Dave Hansen
On 08/22/2018 02:10 PM, Kirill A. Shutemov wrote: >> For x86, mpx_notify_unmap() looks finally zap the VM_MPX vmas in bound table >> range with zap_page_range() and doesn't update vm flags, so it sounds ok to >> me since vmas have been detached, nobody can find those vmas. But, I'm not >> familiar

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Dave Hansen
On 08/22/2018 02:10 PM, Kirill A. Shutemov wrote: >> For x86, mpx_notify_unmap() looks finally zap the VM_MPX vmas in bound table >> range with zap_page_range() and doesn't update vm flags, so it sounds ok to >> me since vmas have been detached, nobody can find those vmas. But, I'm not >> familiar

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Kirill A. Shutemov
On Wed, Aug 22, 2018 at 01:45:44PM -0700, Yang Shi wrote: > > > On 8/22/18 4:19 AM, Vlastimil Babka wrote: > > On 08/15/2018 08:49 PM, Yang Shi wrote: > > > + downgrade_write(>mmap_sem); > > > + > > > + /* Zap mappings with read mmap_sem */ > > > + unmap_region(mm, start_vma, prev, start, end);

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Kirill A. Shutemov
On Wed, Aug 22, 2018 at 01:45:44PM -0700, Yang Shi wrote: > > > On 8/22/18 4:19 AM, Vlastimil Babka wrote: > > On 08/15/2018 08:49 PM, Yang Shi wrote: > > > + downgrade_write(>mmap_sem); > > > + > > > + /* Zap mappings with read mmap_sem */ > > > + unmap_region(mm, start_vma, prev, start, end);

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Yang Shi
On 8/22/18 4:19 AM, Vlastimil Babka wrote: On 08/15/2018 08:49 PM, Yang Shi wrote: + downgrade_write(>mmap_sem); + + /* Zap mappings with read mmap_sem */ + unmap_region(mm, start_vma, prev, start, end); + + arch_unmap(mm, start_vma, start, end); Hmm, did you check

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Yang Shi
On 8/22/18 4:19 AM, Vlastimil Babka wrote: On 08/15/2018 08:49 PM, Yang Shi wrote: + downgrade_write(>mmap_sem); + + /* Zap mappings with read mmap_sem */ + unmap_region(mm, start_vma, prev, start, end); + + arch_unmap(mm, start_vma, start, end); Hmm, did you check

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Yang Shi
On 8/22/18 4:11 AM, Vlastimil Babka wrote: On 08/15/2018 08:49 PM, Yang Shi wrote: + start_vma = munmap_lookup_vma(mm, start, end); + if (!start_vma) + goto out; + if (IS_ERR(start_vma)) { + ret = PTR_ERR(start_vma); + goto out; +

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Yang Shi
On 8/22/18 4:11 AM, Vlastimil Babka wrote: On 08/15/2018 08:49 PM, Yang Shi wrote: + start_vma = munmap_lookup_vma(mm, start, end); + if (!start_vma) + goto out; + if (IS_ERR(start_vma)) { + ret = PTR_ERR(start_vma); + goto out; +

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Vlastimil Babka
On 08/15/2018 08:49 PM, Yang Shi wrote: > + downgrade_write(>mmap_sem); > + > + /* Zap mappings with read mmap_sem */ > + unmap_region(mm, start_vma, prev, start, end); > + > + arch_unmap(mm, start_vma, start, end); Hmm, did you check that all architectures' arch_unmap() is safe

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Vlastimil Babka
On 08/15/2018 08:49 PM, Yang Shi wrote: > + downgrade_write(>mmap_sem); > + > + /* Zap mappings with read mmap_sem */ > + unmap_region(mm, start_vma, prev, start, end); > + > + arch_unmap(mm, start_vma, start, end); Hmm, did you check that all architectures' arch_unmap() is safe

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Vlastimil Babka
On 08/15/2018 08:49 PM, Yang Shi wrote: > + start_vma = munmap_lookup_vma(mm, start, end); > + if (!start_vma) > + goto out; > + if (IS_ERR(start_vma)) { > + ret = PTR_ERR(start_vma); > + goto out; > + } > + > + prev = start_vma->vm_prev; >

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-22 Thread Vlastimil Babka
On 08/15/2018 08:49 PM, Yang Shi wrote: > + start_vma = munmap_lookup_vma(mm, start, end); > + if (!start_vma) > + goto out; > + if (IS_ERR(start_vma)) { > + ret = PTR_ERR(start_vma); > + goto out; > + } > + > + prev = start_vma->vm_prev; >

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-16 Thread Yang Shi
On 8/15/18 7:46 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 02:54:13PM -0700, Yang Shi wrote: On 8/15/18 2:09 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: (not even compiled, and I can see a good opportunity for combining the VM_LOCKED

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-16 Thread Yang Shi
On 8/15/18 7:46 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 02:54:13PM -0700, Yang Shi wrote: On 8/15/18 2:09 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: (not even compiled, and I can see a good opportunity for combining the VM_LOCKED

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Matthew Wilcox
On Wed, Aug 15, 2018 at 02:54:13PM -0700, Yang Shi wrote: > > > On 8/15/18 2:09 PM, Matthew Wilcox wrote: > > On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: > > > (not even compiled, and I can see a good opportunity for combining the > > > VM_LOCKED loop with the has_uprobes

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Matthew Wilcox
On Wed, Aug 15, 2018 at 02:54:13PM -0700, Yang Shi wrote: > > > On 8/15/18 2:09 PM, Matthew Wilcox wrote: > > On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: > > > (not even compiled, and I can see a good opportunity for combining the > > > VM_LOCKED loop with the has_uprobes

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Yang Shi
On 8/15/18 2:09 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: (not even compiled, and I can see a good opportunity for combining the VM_LOCKED loop with the has_uprobes loop) I was rushing to get that sent earlier. Here it is tidied up to

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Yang Shi
On 8/15/18 2:09 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: (not even compiled, and I can see a good opportunity for combining the VM_LOCKED loop with the has_uprobes loop) I was rushing to get that sent earlier. Here it is tidied up to

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Matthew Wilcox
On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: > (not even compiled, and I can see a good opportunity for combining the > VM_LOCKED loop with the has_uprobes loop) I was rushing to get that sent earlier. Here it is tidied up to actually compile. Note the diffstat: mmap.c |

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Matthew Wilcox
On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: > (not even compiled, and I can see a good opportunity for combining the > VM_LOCKED loop with the has_uprobes loop) I was rushing to get that sent earlier. Here it is tidied up to actually compile. Note the diffstat: mmap.c |

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Matthew Wilcox
On Thu, Aug 16, 2018 at 02:49:48AM +0800, Yang Shi wrote: > +static int do_munmap_zap_rlock(struct mm_struct *mm, unsigned long start, > +size_t len, struct list_head *uf) > +{ > + unsigned long end; > + struct vm_area_struct *start_vma, *prev, *vma; > + int

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Matthew Wilcox
On Thu, Aug 16, 2018 at 02:49:48AM +0800, Yang Shi wrote: > +static int do_munmap_zap_rlock(struct mm_struct *mm, unsigned long start, > +size_t len, struct list_head *uf) > +{ > + unsigned long end; > + struct vm_area_struct *start_vma, *prev, *vma; > + int

[RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Yang Shi
When running some mmap/munmap scalability tests with large memory (i.e. > 300GB), the below hung task issue may happen occasionally. INFO: task ps:14018 blocked for more than 120 seconds. Tainted: GE 4.9.79-009.ali3000.alios7.x86_64 #1 "echo 0 >

[RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Yang Shi
When running some mmap/munmap scalability tests with large memory (i.e. > 300GB), the below hung task issue may happen occasionally. INFO: task ps:14018 blocked for more than 120 seconds. Tainted: GE 4.9.79-009.ali3000.alios7.x86_64 #1 "echo 0 >