summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixelBot AutoMerger <android-nexus-securitybot@system.gserviceaccount.com>2021-10-10 18:44:34 -0700
committerSecurityBot <android-nexus-securitybot@system.gserviceaccount.com>2021-10-10 18:44:34 -0700
commit030a0315a57274fe14047ae53fbd79e0a3c2ad92 (patch)
tree796532c656e853786c6d272c2bd6ed0665d5208c
parent33e4a6de88267243012ae615bdc90c2b33d818f0 (diff)
parentf4860f239a4db4a63338df1e6915dc7ce8068d0c (diff)
downloadgpu-030a0315a57274fe14047ae53fbd79e0a3c2ad92.tar.gz
Merge android12-gs-pixel-5.10-sc-qpr1 into android12-gs-pixel-5.10-sc-qpr2
SBMerger: 379283923 Change-Id: If4119654068d6d2b99d29fb4c4c6ab107f2d8806 Signed-off-by: SecurityBot <android-nexus-securitybot@system.gserviceaccount.com>
-rw-r--r--mali_kbase/mmu/mali_kbase_mmu.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mali_kbase/mmu/mali_kbase_mmu.c b/mali_kbase/mmu/mali_kbase_mmu.c
index d296956..e9f8b12 100644
--- a/mali_kbase/mmu/mali_kbase_mmu.c
+++ b/mali_kbase/mmu/mali_kbase_mmu.c
@@ -1746,7 +1746,17 @@ int kbase_mmu_teardown_pages(struct kbase_device *kbdev,
return 0;
}
- rt_mutex_lock(&mmut->mmu_lock);
+ if (!rt_mutex_trylock(&mmut->mmu_lock)) {
+ /*
+ * Sometimes, mmu_lock takes long time to be released.
+ * In that case, kswapd is stuck until it can hold
+ * the lock. Instead, just bail out here so kswapd
+ * could reclaim other pages.
+ */
+ if (current_is_kswapd())
+ return -EBUSY;
+ rt_mutex_lock(&mmut->mmu_lock);
+ }
mmu_mode = kbdev->mmu_mode;