Can a driver create a VMA?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a driver that calls get_user_pages() to map and lock a memory buffer from an app. Unfortunately, the locking part doesn't work very well. The swapper daemon will still swap out the page. I have a test case that uses our custom hardware and DMA to prove it, but we're working on a more portable test case that we can send to the kernel developers. In the meantime, I need to work on an alternative.

Using sys_mlock(), we're able to lock the memory buffer down, but this is not an ideal solution. What I'd like to do is create a new VMA for just the memory buffer, and then lock that VMA. Locking the VMA is what really locks the buffer.

I know the get_user_pages() returns an array of VMAs, but those VMAs most likely include other pages, and I don't want to lock any of those. So what I would like to do is create a brand new VMA, assign it to the application process, and then associate all of the pages from the memory buffer to that VMA.

Is it possible for me to do all that from within a kernel module? I've done quite a few searches, and the only way I've found to do that is with another system call, which I'm trying to avoid.

--
Timur Tabi

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux