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

Configure Feed

Select the types of activity you want to include in your feed.

mm/vma: small VMA lock cleanups

We declare vma_start_read() as a static function in mm/mmap_lock.c, so
there is no need to provide a stub for !CONFIG_PER_VMA_LOCK.

__is_vma_write_locked() is declared in a header and should therefore be
static inline.

Put parens around (refcnt & VMA_LOCK_OFFSET) in is_vma_writer_only() to
make precedence clear.

Link: https://lkml.kernel.org/r/20251024090902.1118174-1-lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Liam Howlett <liam.howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lorenzo Stoakes and committed by
Andrew Morton
b734b9d9 ad8b2e09

+2 -5
+2 -5
include/linux/mmap_lock.h
··· 130 130 * a detached vma happens only in vma_mark_detached() and is a rare 131 131 * case, therefore most of the time there will be no unnecessary wakeup. 132 132 */ 133 - return refcnt & VMA_LOCK_OFFSET && refcnt <= VMA_LOCK_OFFSET + 1; 133 + return (refcnt & VMA_LOCK_OFFSET) && refcnt <= VMA_LOCK_OFFSET + 1; 134 134 } 135 135 136 136 static inline void vma_refcount_put(struct vm_area_struct *vma) ··· 183 183 } 184 184 185 185 /* WARNING! Can only be used if mmap_lock is expected to be write-locked */ 186 - static bool __is_vma_write_locked(struct vm_area_struct *vma, unsigned int *mm_lock_seq) 186 + static inline bool __is_vma_write_locked(struct vm_area_struct *vma, unsigned int *mm_lock_seq) 187 187 { 188 188 mmap_assert_write_locked(vma->vm_mm); 189 189 ··· 281 281 return true; 282 282 } 283 283 static inline void vma_lock_init(struct vm_area_struct *vma, bool reset_refcnt) {} 284 - static inline struct vm_area_struct *vma_start_read(struct mm_struct *mm, 285 - struct vm_area_struct *vma) 286 - { return NULL; } 287 284 static inline void vma_end_read(struct vm_area_struct *vma) {} 288 285 static inline void vma_start_write(struct vm_area_struct *vma) {} 289 286 static inline void vma_assert_write_locked(struct vm_area_struct *vma)