mmap how does kernel know a page is mmaped

kernel neophyte neophyte.hacker001 at gmail.com
Thu Jul 25 13:52:43 EDT 2013


ok,

I am sorry maybe I did not ask the question correctly, all I want to know
is how mmap works underneath, given an address X how does kernel figure out
its a mmaped page ?

-Neo


On Thu, Jul 25, 2013 at 10:04 AM, <Valdis.Kletnieks at vt.edu> wrote:

> On Thu, 25 Jul 2013 09:14:03 -0700, kernel neophyte said:
>
> > Could anyone please explain, how mmap works underneath ? when kernel
> > traveses pgd->pud->pmd->pte how does it know that a particular page is a
> > mmaped page ? is there any special flag ?
>
> Why would the address mapping hardware even *care* that it's an mmap'ed
> page, once the mapping is set up?  For that matter, why would most of
> the kernel code care?
>
> Only time an mmap'ed page is any different than any other process page is
> while the mmap is actually being set up, modified, or torn down.
>
> (And in fact, that's part of why getting the varions sync() calls to play
> nice with mmap() is so hard - because an mmap'ed file page is just a page.
> So noticing that a page got modified and knowing to do stuff like update
> the atime and mtime of the backing file is difficult...)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130725/48c6021c/attachment.html 


More information about the Kernelnewbies mailing list