On 4/20/22 15:37, Mike Kravetz wrote: > > Patch 5 in this series makes basic changes to page table locking for > hugetlb mappings. Currently code uses (split) pmd locks for hugetlb > mappings if page size is PMD_SIZE. A pointer to the pmd is required > to find the page struct containing the lock. However, with pmd sharing > the pmd pointer is not stable until we hold the pmd lock. To solve > this chicken/egg problem, we use the page_table_lock in mm_struct if > the pmd pointer is associated with a mapping where pmd sharing is > possible. A study of the performance implications of this change still > needs to be performed. Sorry, this approach is totally wrong!!! If sharing pmds, we MUST use the pmd specific lock as that is common between processes. If we use the process specific lock in mm_struct we are not synchronizing pmd updates between processes. I am going to rethink the idea of a vma (process) specific synchronization mechanism for pmd sharing. I abandoned this early because of some lock ordering issues, but think there may already exist code to handle situations where we run into trouble with lock order. -- Mike Kravetz