gpu: nvgpu: replace mmap_sem in K5.8

K5.8 onwards, use mmap_lock field instead of mmap_sem in struct mm_struct

bug 200617764

Change-Id: I7655cde105e70e29de9d8047a51569890a1a8019
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2362505
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Bitan Biswas
2020-06-17 10:51:49 -07:00
committed by Alex Waterman
parent fbb6a5bc1c
commit 8f4b41231a

View File

@@ -2115,7 +2115,11 @@ static void alter_usermode_mapping(struct gk20a *g,
return; return;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
down_write(&vma->vm_mm->mmap_lock);
#else
down_write(&vma->vm_mm->mmap_sem); down_write(&vma->vm_mm->mmap_sem);
#endif
/* /*
* This is a no-op for the below cases * This is a no-op for the below cases
@@ -2149,7 +2153,11 @@ static void alter_usermode_mapping(struct gk20a *g,
} }
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
up_write(&vma->vm_mm->mmap_lock);
#else
up_write(&vma->vm_mm->mmap_sem); up_write(&vma->vm_mm->mmap_sem);
#endif
} }
static void alter_usermode_mappings(struct gk20a *g, bool poweroff) static void alter_usermode_mappings(struct gk20a *g, bool poweroff)