Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-06-06 Thread Hugh Dickins
On Wed, 31 May 2023, Jann Horn wrote: > On Mon, May 29, 2023 at 8:25 AM Hugh Dickins wrote: > > +static void retract_page_tables(struct address_space *mapping, pgoff_t > > pgoff) ... > > +* Note that vma->anon_vma check is racy: it can be set > > after > > +* the

Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-06-01 Thread Jason Gunthorpe
On Thu, Jun 01, 2023 at 12:18:43AM +0200, Jann Horn wrote: > 3. We have to *serialize* with page table walks performed by the > IOMMU. We're doing an RCU barrier to synchronize against page table > walks from the MMU, but without an appropriate mmu_notifier call, we > have nothing to ensure that

Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-05-31 Thread Jann Horn
On Wed, May 31, 2023 at 10:54 PM Peter Xu wrote: > On Wed, May 31, 2023 at 05:34:58PM +0200, Jann Horn wrote: > > On Mon, May 29, 2023 at 8:25 AM Hugh Dickins wrote: > > > -static int retract_page_tables(struct address_space *mapping, pgoff_t > > > pgoff, > > > -

Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-05-31 Thread Peter Xu
On Wed, May 31, 2023 at 05:34:58PM +0200, Jann Horn wrote: > On Mon, May 29, 2023 at 8:25 AM Hugh Dickins wrote: > > -static int retract_page_tables(struct address_space *mapping, pgoff_t > > pgoff, > > - struct mm_struct *target_mm, > > -

Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-05-31 Thread Peter Xu
On Tue, May 30, 2023 at 05:38:25PM -0700, Hugh Dickins wrote: > Thanks for looking, Peter: I was well aware of you dropping several hints > that you wanted to see what's intended before passing judgment on earlier > series, and I preferred to get on with showing this series, than go into > detail

Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-05-31 Thread Jann Horn
On Mon, May 29, 2023 at 8:25 AM Hugh Dickins wrote: > -static int retract_page_tables(struct address_space *mapping, pgoff_t pgoff, > - struct mm_struct *target_mm, > - unsigned long target_addr, struct page *hpage, > -

Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-05-30 Thread Hugh Dickins
Thanks for looking, Peter: I was well aware of you dropping several hints that you wanted to see what's intended before passing judgment on earlier series, and I preferred to get on with showing this series, than go into detail in responses to you there - thanks for your patience :) On Mon, 29

Re: [PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-05-29 Thread Peter Xu
On Sun, May 28, 2023 at 11:25:15PM -0700, Hugh Dickins wrote: > Simplify shmem and file THP collapse's retract_page_tables(), and relax > its locking: to improve its success rate and to lessen impact on others. > > Instead of its MADV_COLLAPSE case doing set_huge_pmd() at target_addr of >

[PATCH 09/12] mm/khugepaged: retract_page_tables() without mmap or vma lock

2023-05-29 Thread Hugh Dickins
Simplify shmem and file THP collapse's retract_page_tables(), and relax its locking: to improve its success rate and to lessen impact on others. Instead of its MADV_COLLAPSE case doing set_huge_pmd() at target_addr of target_mm, leave that part of the work to madvise_collapse() calling