Messages in this thread |  | | | Date | Sat, 06 Nov 1999 02:38:46 -0500 | | From | Juan Gonzalez <> | | Subject | locking user memory and kiobuf |
| |
I'm in the process of porting a WinNT driver to Linux. For a specific IOCtl call, the driver receives pointers to multiple user buffers. Based on different conditions, the driver needs to transfer data to/from one of these buffers via DMA (actually PCI Bus Master), and then return to the user when the transfer is complete. The user doesn't mlock any of them, so it's up to the driver to handle it. Currently, I have this working by first copying the user data to a driver buffer (locked) and then DMAing from there. It works, but large buffers move pretty slow. To improve performance, it would be nice if the driver could lock the required user buffer and transfer directly to/from there without having to copy. We have implemented this strategy successfully in WinNT, OS/2, and AIX, with very good performance improvements.
Three questions:
1. From what I've read in the archives, it seems that locking user memory from a driver isn't supported in current releases of the Linux kernel (2.2.xx). Is that correct?
2. As I understand, there's a new "kiobuf mechanism" being added in 2.3.xx . Does that provide a solution to this particular issue?
3. Alternatively, can I directly manipulate the PG_locked flag for the pages in question? For example, I could ensure the page(s) are in physical memory by accessing a word in that page (copy_to_user), and then set the PG_locked bit for the page to prevent swapping. Wouldn't this effectively "lock" the page for safe DMA transfers? After the transfer, I could clear the PG_locked bit and return to the user. Or would this be considered dangerous practice? Do I also need PG_reserved?
Thank you, Juan Gonzalez
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
|  |