nvgpu: linux: ioctl: Avoid call of mmap_write_{trylock,unlock}

The API mmap_write_trylock() is deleted from core kernel with
following change in Linux 6.6
---
commit cf95e337cb63cfbf5c9ea1a1f64f9818b979e3b3
Author: Hugh Dickins <hughd@google.com>
Date:   Tue Jul 11 21:48:48 2023 -0700

    mm: delete mmap_write_trylock() and vma_try_start_write()
----

Replace the mmap_write_trylock() call with down_write_trylock with
appropriate argument.

Bug 4346767

Change-Id: I076ad51b012c706a4bada3bd303db1802cca34dd
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3007342
(cherry picked from commit 344c682a2077eb95c7d24ef1c0bf40eda70e524e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3036796
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-10-31 11:14:38 +00:00
committed by mobile promotions
parent 261d4bed13
commit 3fdada39ff

View File

@@ -2915,7 +2915,7 @@ static int alter_usermode_mapping(struct gk20a *g,
* does it in reverse order. Trylock is a way to avoid deadlock.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if (!mmap_write_trylock(vma->vm_mm)) {
if (!down_write_trylock(&vma->vm_mm->mmap_lock)) {
#else
if (!down_write_trylock(&vma->vm_mm->mmap_sem)) {
#endif
@@ -2947,7 +2947,7 @@ static int alter_usermode_mapping(struct gk20a *g,
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
mmap_write_unlock(vma->vm_mm);
up_write(&vma->vm_mm->mmap_lock);
#else
up_write(&vma->vm_mm->mmap_sem);
#endif