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. Thanks, -- Peter Xu