On 01/30/2017 09:10 PM, Anshuman Khandual wrote: >> This is happening with mmap_sem held for read. Correct? Is it OK that >> you're modifying the VMA? That vm_flags manipulation is non-atomic, so >> how can that even be safe? > Hmm. should it be done with mmap_sem being held for write. Will look > into this further. But intercepting the page faults inside alloc_pages_vma() > for tagging the VMA is okay from over all design perspective ?. Or this > should be moved up or down the call chain in the page fault path ?
Doing it in the fault path seems wrong to me. Apps have to take *explicit* action to go and get access to device memory. It seems like we should mark the VMA *then*, at the time of the explicit action. I also think _implying_ that we want KSM, etc... turned off just because of the target of an mbind() is a bad idea. Apps have to ask for this stuff *explicitly*, so why not also have them turn KSM off explicitly?