Messages in this thread | | | From | James Houghton <> | Date | Thu, 19 Jan 2023 15:06:27 -0800 | Subject | Re: [PATCH 35/46] hugetlb: add MADV_COLLAPSE for hugetlb |
| |
On Thu, Jan 19, 2023 at 2:37 PM Peter Xu <peterx@redhat.com> wrote: > > On Thu, Jan 05, 2023 at 10:18:33AM +0000, James Houghton wrote: > > + /* > > + * Grab the VMA lock and mapping sem for writing. This will prevent > > + * concurrent high-granularity page table walks, so that we can safely > > + * collapse and free page tables. > > + * > > + * This is the same locking that huge_pmd_unshare requires. > > + */ > > + hugetlb_vma_lock_write(vma); > > + i_mmap_lock_write(vma->vm_file->f_mapping); > > One thing I just noticed - do we need the mmap write lock here? I don't > quickly see what stops another thread from having the mmap read and walking > upon the pgtables being collapsed.
Maybe. Does huge_pmd_unshare() have the same problem?
| |