summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Goyal <layog@google.com>2022-03-07 18:18:29 -0800
committerMinchan Kim <minchan@google.com>2022-03-14 18:24:05 +0000
commit3d9f70261b023712c5113fb715f114ad8db9cfae (patch)
treedce1c5a9c496f195d66efad0ccd167945b329b49
parent4574bd289c9d48e623727c9c7e790ff1126f4405 (diff)
downloadgpu-3d9f70261b023712c5113fb715f114ad8db9cfae.tar.gz
mali_kbase: Use FOLL_LONGTERM to pin user buffer on import
FOLL_LONGTERM flag allows to remap CMA pages which reduces the pressure on future CMA allocations. Fix: 221777589 Test: To be tested by minchan@ Change-Id: Ib7b221e4f95610fc85ac3399a31ac98f5a57fa23 Signed-off-by: Ankit Goyal <layog@google.com> (cherry picked from commit ac855831a4d92f29298323326aeb84ace876c55c)
-rw-r--r--mali_kbase/mali_kbase_mem_linux.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mali_kbase/mali_kbase_mem_linux.c b/mali_kbase/mali_kbase_mem_linux.c
index d76da0e..762b5a6 100644
--- a/mali_kbase/mali_kbase_mem_linux.c
+++ b/mali_kbase/mali_kbase_mem_linux.c
@@ -1649,8 +1649,15 @@ KERNEL_VERSION(4, 5, 0) > LINUX_VERSION_CODE
faulted_pages = get_user_pages(address, *va_pages,
write ? FOLL_WRITE : 0, pages, NULL);
#else
+ /*
+ * User buffers should be pinned with FOLL_LONGTERM flag as their usage
+ * cannot be time bounded. This will make sure that we do not pin pages
+ * in the CMA region.
+ */
+ pages = user_buf->pages;
faulted_pages = pin_user_pages(address, *va_pages,
- write ? FOLL_WRITE : 0, pages, NULL);
+ write ? FOLL_WRITE | FOLL_LONGTERM : FOLL_LONGTERM,
+ pages, NULL);
#endif
up_read(kbase_mem_get_process_mmap_lock());