]> www.infradead.org Git - users/jedix/linux-maple.git/commit
udmabuf: pre-fault when first page fault
authorHuan Yang <link@vivo.com>
Wed, 18 Sep 2024 02:52:24 +0000 (10:52 +0800)
committerVivek Kasireddy <vivek.kasireddy@intel.com>
Fri, 20 Sep 2024 21:07:31 +0000 (14:07 -0700)
commitf0bbcc258e81288212c2092c587ae06428196598
tree17b4e8fe1faf91013fdbf7e4c8e6436cc2ca447e
parent79cc4d2bf2c7b90d9f06e3f67e541978e96b9a64
udmabuf: pre-fault when first page fault

The current udmabuf mmap only fills the physical memory to the
corresponding virtual address when the user actually accesses the
virtual address.

However, the current udmabuf has already obtained and pinned the folio
upon completion of the creation.This means that the physical memory has
already been acquired, rather than being accessed dynamically.

As a result, the page fault has lost its purpose as a demanding
page. Due to the fact that page fault requires trapping into kernel mode
and filling in when accessing the corresponding virtual address in mmap,
when creating a large size udmabuf, this represents a considerable
overhead.

This patch fill the pfn into page table, and then pre-fault each pfn
into vma, when first access.

Notice, if anything wrong , we do not return an error during this
pre-fault step. However, an error will be returned if the failure occurs
when the addr is truly accessed

Suggested-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Huan Yang <link@vivo.com>
Acked-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240918025238.2957823-2-link@vivo.com
drivers/dma-buf/udmabuf.c