Messages in this thread | | | Date | Mon, 17 Aug 2009 23:24:09 +0100 (BST) | From | Alexey Korolev <> | Subject | [PATCH 0/3]HTLB mapping for drivers (take 2) |
| |
Hi,
The patch set listed below provides device drivers with the ability to map memory regions to user space via HTLB interfaces.
Why we need it? Device drivers often need to map memory regions to user-space to allow efficient data handling in user mode. Involving hugetlb mapping may bring performance gain if mapped regions are relatively large. Our tests showed that it is possible to gain up to 7% performance if hugetlb mapping is enabled. In my case involving hugetlb starts to make sense if buffer is more or equal to 4MB. Since typically, device throughput increase over time there are more and more reasons to involve huge pages to remap large regions. For example hugetlb remapping could be important for performance of Data acquisition systems (logic analyzers, DSO), Network monitoring systems (packet capture), HD video capture/frame buffer and probably other.
How it is implemented? Implementation and idea is very close to what is already done in ipc/shm.c. We create file on hugetlbfs vfsmount point and populate file with pages we want to mmap. Then we associate hugetlbfs file mapping with file mapping we want to access.
So typical procedure for mapping of huge pages to userspace by drivers should be: 1 Allocate some huge pages 2 Create file on vfs mount of hugetlbfs 3 Add pages to page cache of mapping associated with hugetlbfs file 4 Replace file's mapping with the hugetlbfs file mapping .............. 5 Remove pages from page cache 6 Remove hugetlbfs file 7 Free pages (Please find example in following messages)
Detailed description is given in the following messages. Thanks a lot to Mel Gorman who gave good advice and code prototype and Stephen Donnelly for assistance in description composing.
Alexey
| |