Hi, I'm trying to mmap a device's memory (not real device) and share it across processes. So far what I've understood is that, 1. I create a vm_operations_struct->fault and vm_operations_struct->page_mkwrite 2. The first time a fault occurs my fault handler would allocate a page and install it in the vm_fault structure. The corresponding vm_area_struct i'll mark as VM_SHARED|VM_READ. Should VM_SHARED be really set here? I'm sharing the page not the vm_area_struct. 3. On a fault I can just assign the same page and in page_mkwrite i can check if there's someone already writing to the page and tell other process that it has to wait or throw error that page can't be made writeable as of now. 4. vm_operations_struct->close, to have a put_page call. Question 1 Let's just say if each vma had to be allocated a page individually, that page would have been allocated using GFP_HIGHUSER|GFP_USER. In that case would the module needed to have kept track of the pages or when the process exits the page structure would be in same state as the last call to put_page? Question 2 If a process unmaps or just exits the unmap_vmas would be called which would call unmap_single_vmas. Now I haven't digged too much within that but it plays around with pte of the page but doesn't alter page_count or anything. So would that affect the other process's vmas which are sharing this page? I'm referring to zap_pte_range, but it seems to flush tlbs and not remove the pte actually[Correct?]. Since the same code would be used for page cache pages and their pte won't be removed in case they are low-mem pages. So if let's say somebody tries to access that particular address it'll not fault although the process owning it has exited? -- ---P.K.S _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies