Re: using remap_page_range()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Jim Bauer <jfbauer@nfr.com> wrote:
> On Wed, 2003-06-11 at 06:06, Biswaranjan wrote:

> > we have two buffers in the kernel..
> > the user is able to mmap one buffer to the user space
> > using mmap() system call.
> > we have used remap_page_range() to setup the mapping.with
> > one buffer. this is working fine
> > ...
> > ... 
> > 
> > i think we are supposed to remove the old mappings
> > with zap_page_range()..but since we are compiling as a
> > module this function is inaccessible (dont know why)
> 
> I believe the zap_page_range() will do the trick.  As 
> for it not being exported, yeah, that would be a pain. 
> You could either 1) export it in your own kernel(s), 
> or 2) submit a patch to have it exported in official 
> releases.  You'll still need to do #1 in the short term.

You don't really need zap_page_range() to remove the old
mapping. Since you know the virtual address at which the
page is mapped, you can also find out where the corresponding
PTE (page table entry) is. Then you can clear the entry
with ptep_get_and_clear(). This lets you save the old PTE,
from which you can get to the page using pte_page(). You
can then free the page or do whatever else you want with it.

My understanding is that zap_page_range() should not be
used for pages allocated by kernel or kernel modules. 

-Ravi.



__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux