Changeset 85430 in vbox for trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
- Timestamp:
- Jul 23, 2020 11:57:35 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
r83471 r85430 71 71 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) 72 72 # define gfp_t unsigned 73 #endif 74 75 /* 76 * Wrappers around mmap_lock/mmap_sem difference. 77 */ 78 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) 79 # define LNX_MM_DOWN_READ(a_pMm) down_read(&(a_pMm)->mmap_lock) 80 # define LNX_MM_UP_READ(a_pMm) up_read(&(a_pMm)->mmap_lock) 81 # define LNX_MM_DOWN_WRITE(a_pMm) down_write(&(a_pMm)->mmap_lock) 82 # define LNX_MM_UP_WRITE(a_pMm) up_write(&(a_pMm)->mmap_lock) 83 #else 84 # define LNX_MM_DOWN_READ(a_pMm) down_read(&(a_pMm)->mmap_sem) 85 # define LNX_MM_UP_READ(a_pMm) up_read(&(a_pMm)->mmap_sem) 86 # define LNX_MM_DOWN_WRITE(a_pMm) down_write(&(a_pMm)->mmap_sem) 87 # define LNX_MM_UP_WRITE(a_pMm) up_write(&(a_pMm)->mmap_sem) 73 88 #endif 74 89 … … 183 198 * an empty user space mapping. 184 199 * 185 * We acquire the mmap_sem of the task!200 * We acquire the mmap_sem/mmap_lock of the task! 186 201 * 187 202 * @returns Pointer to the mapping. … … 223 238 ulAddr = vm_mmap(NULL, R3PtrFixed, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, 0); 224 239 #else 225 down_write(&pTask->mm->mmap_sem);240 LNX_MM_DOWN_WRITE(pTask->mm); 226 241 ulAddr = do_mmap(NULL, R3PtrFixed, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, 0); 227 up_write(&pTask->mm->mmap_sem);242 LNX_MM_UP_WRITE(pTask->mm); 228 243 #endif 229 244 } … … 233 248 ulAddr = vm_mmap(NULL, 0, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS, 0); 234 249 #else 235 down_write(&pTask->mm->mmap_sem);250 LNX_MM_DOWN_WRITE(pTask->mm); 236 251 ulAddr = do_mmap(NULL, 0, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS, 0); 237 up_write(&pTask->mm->mmap_sem);252 LNX_MM_UP_WRITE(pTask->mm); 238 253 #endif 239 254 if ( !(ulAddr & ~PAGE_MASK) … … 258 273 * Undoes what rtR0MemObjLinuxDoMmap did. 259 274 * 260 * We acquire the mmap_sem of the task!275 * We acquire the mmap_sem/mmap_lock of the task! 261 276 * 262 277 * @param pv The ring-3 mapping. … … 270 285 vm_munmap((unsigned long)pv, cb); 271 286 #elif defined(USE_RHEL4_MUNMAP) 272 down_write(&pTask->mm->mmap_sem);287 LNX_MM_DOWN_WRITE(pTask->mm); 273 288 do_munmap(pTask->mm, (unsigned long)pv, cb, 0); /* should it be 1 or 0? */ 274 up_write(&pTask->mm->mmap_sem);289 LNX_MM_UP_WRITE(pTask->mm); 275 290 #else 276 down_write(&pTask->mm->mmap_sem);291 LNX_MM_DOWN_WRITE(pTask->mm); 277 292 do_munmap(pTask->mm, (unsigned long)pv, cb); 278 up_write(&pTask->mm->mmap_sem);293 LNX_MM_UP_WRITE(pTask->mm); 279 294 #endif 280 295 } … … 594 609 Assert(pTask); 595 610 if (pTask && pTask->mm) 596 down_read(&pTask->mm->mmap_sem);611 LNX_MM_DOWN_READ(pTask->mm); 597 612 598 613 iPage = pMemLnx->cPages; … … 609 624 610 625 if (pTask && pTask->mm) 611 up_read(&pTask->mm->mmap_sem);626 LNX_MM_UP_READ(pTask->mm); 612 627 } 613 628 /* else: kernel memory - nothing to do here. */ … … 1077 1092 if (papVMAs) 1078 1093 { 1079 down_read(&pTask->mm->mmap_sem);1094 LNX_MM_DOWN_READ(pTask->mm); 1080 1095 1081 1096 /* … … 1163 1178 } 1164 1179 1165 up_read(&pTask->mm->mmap_sem);1180 LNX_MM_UP_READ(pTask->mm); 1166 1181 1167 1182 RTMemFree(papVMAs); … … 1190 1205 } 1191 1206 1192 up_read(&pTask->mm->mmap_sem);1207 LNX_MM_UP_READ(pTask->mm); 1193 1208 1194 1209 RTMemFree(papVMAs); … … 1605 1620 size_t iPage; 1606 1621 1607 down_write(&pTask->mm->mmap_sem);1622 LNX_MM_DOWN_WRITE(pTask->mm); 1608 1623 1609 1624 rc = VINF_SUCCESS; … … 1722 1737 #endif /* CONFIG_NUMA_BALANCING */ 1723 1738 1724 up_write(&pTask->mm->mmap_sem);1739 LNX_MM_UP_WRITE(pTask->mm); 1725 1740 1726 1741 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.