Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: update mmap_sem comments to refer to mmap_lock

The rename from mm->mmap_sem to mm->mmap_lock was performed in commit
da1c55f1b272 ("mmap locking API: rename mmap_sem to mmap_lock") and commit
c1e8d7c6a7a6 ("map locking API: convert mmap_sem comments"), however some
incorrect comments remain.

This patch simply corrects those comments which are obviously incorrect
within mm itself.

Link: https://lkml.kernel.org/r/33fba04389ab63fc4980e7ba5442f521df6dc657.1673048927.git.lstoakes@gmail.com
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lorenzo Stoakes and committed by
Andrew Morton
8651a137 0411d6ee

+7 -7
+1 -1
include/linux/mm_types.h
··· 581 581 /* 582 582 * For private and shared anonymous mappings, a pointer to a null 583 583 * terminated string containing the name given to the vma, or NULL if 584 - * unnamed. Serialized by mmap_sem. Use anon_vma_name to access. 584 + * unnamed. Serialized by mmap_lock. Use anon_vma_name to access. 585 585 */ 586 586 struct anon_vma_name *anon_name; 587 587 #endif
+1 -1
include/linux/page_ref.h
··· 301 301 * 302 302 * You can also use this function if you're holding a lock that prevents 303 303 * pages being frozen & removed; eg the i_pages lock for the page cache 304 - * or the mmap_sem or page table lock for page tables. In this case, 304 + * or the mmap_lock or page table lock for page tables. In this case, 305 305 * it will always succeed, and you could have used a plain folio_get(), 306 306 * but it's sometimes more convenient to have a common function called 307 307 * from both locked and RCU-protected contexts.
+2 -2
mm/hugetlb.c
··· 1183 1183 1184 1184 /* 1185 1185 * Reset and decrement one ref on hugepage private reservation. 1186 - * Called with mm->mmap_sem writer semaphore held. 1186 + * Called with mm->mmap_lock writer semaphore held. 1187 1187 * This function should be only used by move_vma() and operate on 1188 1188 * same sized vma. It should never come here with last ref on the 1189 1189 * reservation. ··· 5152 5152 5153 5153 /* 5154 5154 * We don't have to worry about the ordering of src and dst ptlocks 5155 - * because exclusive mmap_sem (or the i_mmap_lock) prevents deadlock. 5155 + * because exclusive mmap_lock (or the i_mmap_lock) prevents deadlock. 5156 5156 */ 5157 5157 if (src_ptl != dst_ptl) 5158 5158 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
+1 -1
mm/madvise.c
··· 130 130 #endif /* CONFIG_ANON_VMA_NAME */ 131 131 /* 132 132 * Update the vm_flags on region of a vma, splitting it or merging it as 133 - * necessary. Must be called with mmap_sem held for writing; 133 + * necessary. Must be called with mmap_lock held for writing; 134 134 * Caller should ensure anon_name stability by raising its refcount even when 135 135 * anon_name belongs to a valid vma because this function might free that vma. 136 136 */
+2 -2
mm/mmap.c
··· 2294 2294 * @start: The aligned start address to munmap. 2295 2295 * @end: The aligned end address to munmap. 2296 2296 * @uf: The userfaultfd list_head 2297 - * @downgrade: Set to true to attempt a write downgrade of the mmap_sem 2297 + * @downgrade: Set to true to attempt a write downgrade of the mmap_lock 2298 2298 * 2299 2299 * If @downgrade is true, check return code for potential release of the lock. 2300 2300 */ ··· 2469 2469 * @len: The length of the range to munmap 2470 2470 * @uf: The userfaultfd list_head 2471 2471 * @downgrade: set to true if the user wants to attempt to write_downgrade the 2472 - * mmap_sem 2472 + * mmap_lock 2473 2473 * 2474 2474 * This function takes a @mas that is either pointing to the previous VMA or set 2475 2475 * to MA_START and sets it up to remove the mapping(s). The @len will be