@@ -957,15 +957,22 @@ void NV_API_CALL nv_set_safe_to_mmap_locked(
957957}
958958
959959#if !NV_CAN_CALL_VMA_START_WRITE
960+
961+ #if defined(VM_REFCNT_EXCLUDE_READERS_FLAG )
962+ #define NV_VMA_LOCK_OFFSET VM_REFCNT_EXCLUDE_READERS_FLAG
963+ #else
964+ #define NV_VMA_LOCK_OFFSET VMA_LOCK_OFFSET
965+ #endif
966+
960967static NvBool nv_vma_enter_locked (struct vm_area_struct * vma , NvBool detaching )
961968{
962- NvU32 tgt_refcnt = VMA_LOCK_OFFSET ;
969+ NvU32 tgt_refcnt = NV_VMA_LOCK_OFFSET ;
963970 NvBool interrupted = NV_FALSE ;
964971 if (!detaching )
965972 {
966973 tgt_refcnt ++ ;
967974 }
968- if (!refcount_add_not_zero (VMA_LOCK_OFFSET , & vma -> vm_refcnt ))
975+ if (!refcount_add_not_zero (NV_VMA_LOCK_OFFSET , & vma -> vm_refcnt ))
969976 {
970977 return NV_FALSE ;
971978 }
@@ -995,7 +1002,7 @@ static NvBool nv_vma_enter_locked(struct vm_area_struct *vma, NvBool detaching)
9951002 if (interrupted )
9961003 {
9971004 // Clean up on error: release refcount and dep_map
998- refcount_sub_and_test (VMA_LOCK_OFFSET , & vma -> vm_refcnt );
1005+ refcount_sub_and_test (NV_VMA_LOCK_OFFSET , & vma -> vm_refcnt );
9991006 rwsem_release (& vma -> vmlock_dep_map , _RET_IP_ );
10001007 return NV_FALSE ;
10011008 }
@@ -1011,7 +1018,7 @@ void nv_vma_start_write(struct vm_area_struct *vma)
10111018{
10121019 NvU32 mm_lock_seq ;
10131020 NvBool locked ;
1014- if (__is_vma_write_locked (vma , & mm_lock_seq ))
1021+ if (nv_is_vma_write_locked (vma , & mm_lock_seq ))
10151022 return ;
10161023
10171024 locked = nv_vma_enter_locked (vma , NV_FALSE );
@@ -1020,7 +1027,7 @@ void nv_vma_start_write(struct vm_area_struct *vma)
10201027 if (locked )
10211028 {
10221029 NvBool detached ;
1023- detached = refcount_sub_and_test (VMA_LOCK_OFFSET , & vma -> vm_refcnt );
1030+ detached = refcount_sub_and_test (NV_VMA_LOCK_OFFSET , & vma -> vm_refcnt );
10241031 rwsem_release (& vma -> vmlock_dep_map , _RET_IP_ );
10251032 WARN_ON_ONCE (detached );
10261033 }
0 commit comments