Skip to content

Commit 86824e6

Browse files
johnhubbardlynxeye-dev
authored andcommitted
drm/etnaviv: convert get_user_pages() --> pin_user_pages()
This code was using get_user_pages*(), in a "Case 2" scenario (DMA/RDMA), using the categorization from [1]. That means that it's time to convert the get_user_pages*() + put_page() calls to pin_user_pages*() + unpin_user_pages() calls. There is some helpful background in [2]: basically, this is a small part of fixing a long-standing disconnect between pinning pages, and file systems' use of those pages. [1] Documentation/core-api/pin_user_pages.rst [2] "Explicit pinning of user-space pages": https://lwn.net/Articles/807108/ Signed-off-by: John Hubbard <[email protected]> Signed-off-by: Lucas Stach <[email protected]>
1 parent b3a9e3b commit 86824e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/etnaviv/etnaviv_gem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,10 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
675675
uint64_t ptr = userptr->ptr + pinned * PAGE_SIZE;
676676
struct page **pages = pvec + pinned;
677677

678-
ret = get_user_pages_fast(ptr, num_pages,
678+
ret = pin_user_pages_fast(ptr, num_pages,
679679
!userptr->ro ? FOLL_WRITE : 0, pages);
680680
if (ret < 0) {
681-
release_pages(pvec, pinned);
681+
unpin_user_pages(pvec, pinned);
682682
kvfree(pvec);
683683
return ret;
684684
}
@@ -702,7 +702,7 @@ static void etnaviv_gem_userptr_release(struct etnaviv_gem_object *etnaviv_obj)
702702
if (etnaviv_obj->pages) {
703703
int npages = etnaviv_obj->base.size >> PAGE_SHIFT;
704704

705-
release_pages(etnaviv_obj->pages, npages);
705+
unpin_user_pages(etnaviv_obj->pages, npages);
706706
kvfree(etnaviv_obj->pages);
707707
}
708708
}

0 commit comments

Comments
 (0)