lkml.org 
[lkml]   [2023]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 35/46] hugetlb: add MADV_COLLAPSE for hugetlb
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

\
 
 \ /
  Last update: 2023-03-26 23:48    [W:0.319 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site