Greetings, I'm reading Rubini, p.384-5, regarding mmap() and remap_pange_range(). He references the char/mem.c device driver in the linux kernel, and using that code provides an example of phsyical memory mapping to a process virtual address. The code I'm interested in is attached to the bottom. Specifically, I'm confused as to the usage of the line of code: /* Don't try to swap out physical pages.. */ vma->vm_flags |= VM_RESERVED; I want to do this in my own code: map a physical device page of memory to user space, and be sure its not swapped out. What confuses me is that vma->vm_flags never seems to get used by any of char/mem.c or any or Rubini's discussion examples. Does this code actually do anything? Can someone explain how? Thanks alot for your interest! Code from char/mem.c: static int mmap_mem(struct file * file, struct vm_area_struct * vma) { unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; /* * Accessing memory above the top the kernel knows about or * through a file pointer that was marked O_SYNC will be * done non-cached. */ if (noncached_address(offset) || (file->f_flags & O_SYNC)) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); /* Don't try to swap out physical pages.. */ vma->vm_flags |= VM_RESERVED; /* * Don't dump addresses that are not real memory to a core file. */ if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC)) vma->vm_flags |= VM_IO; if (remap_page_range(vma->vm_start, offset, vma->vm_end-vma->vm_start, vma->vm_page_prot)) return -EAGAIN; return 0; } ________________________________________ Nat Ersoz Myrio Corporation -o) nat.ersoz@myrio.com Cell: 425.417.5182 /\\ Phone: 425.897.7278 Fax: 425.897.5600 _\_V 3500 Carillon Point Kirkland, WA 98033 -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/