Skip to contentSkip to conversation

Conceptual difference between VM_CAN_NONLINEAR and VM_NONLINEAR ; path by which VM_NONLINEAR is suppose to be set.

DISCUSSION Piet Delaney 1 participant 1 message Mar 5, 2010 Memory management

lore
Share & tools
lore
#0 lore raw

I'm getting a PANIC while working with mmap'd files due to the VM_NONLINEAR not being set when working with the pte's. I looked quite a few places and haven't found a clear explanation of how VM_NONLINEAR differs conceptually from VM_CAN_NONLINEAR. It looks like VM_CAN_NONLINEAR is suppose to be set earlier and VM_NONLINEAR later when something in particular is done. I see it set via the remap_file_pages() system call but not by mmap() via shmem_mmap().

Our open_posix_testsuite/conformance/interfaces/mmap/6-2.test panic is avoided with by setting VM_NONLINEAR when the file is mapped but I really doubt this is appropriate as the test runs fine on i386.
------------------------------------------------------------------------
static int shmem_mmap(struct file *file, struct vm_area_struct *vma)

{
         file_accessed(file);
         vma->vm_ops = &shmem_vm_ops;
#if 1
	/* Wrong but didn't panic */
         vma->vm_flags |= (VM_CAN_NONLINEAR|VM_NONLINEAR);
#else
	/* Right but panics here via LTP posix mmap/6-2.test */
         vma->vm_flags |= VM_CAN_NONLINEAR;
#endif
         return 0;
}

-------------------------------------------------------------------------

I was hopping this hack would panic the system and that would help explain why this approach is wrong, but unfortunately it worked.

Could someone take a minute and explain the conceptual difference of these two vma flags and the path by which the VM_NONLINEAR flag is suppose to be set.

-piet

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>