hugetlbfs: use i_mmap_rwsem for more pmd sharing synchronization
Patch series "hugetlbfs: use i_mmap_rwsem for more synchronization", v2. While discussing the issue with huge_pte_offset [1], I remembered that there were more outstanding hugetlb races. These issues are: 1) For shared pmds, huge PTE pointers returned by huge_pte_alloc can become invalid via a call to huge_pmd_unshare by another thread. 2) hugetlbfs page faults can race with truncation causing invalid global reserve counts and state. A previous attempt was made to use i_mmap_rwsem in this manner as described at [2]. However, those patches were reverted starting with [3] due to locking issues. To effectively use i_mmap_rwsem to address the above issues it needs to be held (in read mode) during page fault processing. However, during fault processing we need to lock the page we will be adding. Lock ordering requires we take page lock before i_mmap_rwsem. Waiting until after taking the page lock is too late in the fault process fo...
Showing
- fs/hugetlbfs/inode.c 2 additions, 0 deletionsfs/hugetlbfs/inode.c
- include/linux/fs.h 5 additions, 0 deletionsinclude/linux/fs.h
- include/linux/hugetlb.h 8 additions, 0 deletionsinclude/linux/hugetlb.h
- mm/hugetlb.c 145 additions, 11 deletionsmm/hugetlb.c
- mm/memory-failure.c 27 additions, 2 deletionsmm/memory-failure.c
- mm/migrate.c 22 additions, 3 deletionsmm/migrate.c
- mm/rmap.c 16 additions, 1 deletionmm/rmap.c
- mm/userfaultfd.c 9 additions, 2 deletionsmm/userfaultfd.c
Please register or sign in to comment