[openib-general] get_user_pages() vs. sys_mlock() and 2.6 kernel
Timur Tabi
timur.tabi at ammasso.com
Tue Sep 28 15:34:54 PDT 2004
Libor Michalek wrote:
> I've seen the problem in test cases, so it definetly can happen in 2.4.
> Looking at the 2.6 code the problem appears to be fixed, but I have not
> had a chance to run tests to verify it. Good place to take look if you
> are interested is in launder_page() and try_to_unmap() in the kernel.
I'm afraid it has not been fixed in 2.6. I just ran our memory locking
tests, and it failed with get_user_pages running on Suse Linux 9.1
(kernel 2.6.4).
The test app does this:
1) Calls our driver, which issues a get_user_pages() call for one page.
2) Using pgd/pmd/pte_offset, gets the physical address for the page
3) Tries allocate 1GB of memory (this system has 1GB of physical RAM).
4) Tries to get the physical address again.
In step 4, the physical address is often zero, which means either
pgd_offset or pmd_offset failed. This indicates the page was swapped out.
I don't understand how this bug can continue to exist after all this
time. get_user_pages() is supposed to lock the memory, because drivers
use it for DMA'ing directly into user memory.
--
Timur Tabi
Staff Software Engineer
timur.tabi at ammasso.com
More information about the general
mailing list