On Thu, Jul 25, 2013 at 5:18 PM, <Valdis.Kletnieks@xxxxxx> wrote:
Thanks I get it now. On Thu, 25 Jul 2013 16:57:44 -0700, kernel neophyte said:> and understand how mmap works, given an address *X*, how does the Linux
> I am sorry, its still not clear to me. All I am asking is I want to know
> kernel figure out that *X* is an mmaped page?
Before you ask *how* it does it, first figure out if it does it *at all*.
The reason you can't figure out how the swami is levitating is because
they aren't actually levitating at all.
:-) Good one!
No, because no flag is needed.
> Is there a special flag in
> the page table entry?
Maybe, maybe not. If the page is resident in memory there's no page fault.
> Does the access generate a page fault ?
And if it's not resident, it gets paged in from wherever the backing page
happens to be.
The handler doesn't *care* if it's mmaped. All it has to know is (1) this
> If so, how
> does the handler find out it is an mmaped address?
page isn't in memory, (2) it needs to be in memory, and (3) so please schedule
the I/O to read it from block NNNN of device XXYY just like any *other*
page being read in because of a page fault.
Thanks, I get it now.
The *only* thing "magical" about an mmap'ed page is that the pointer to where
to read/write it might (sometimes) point at someplace that's not a swap space.
Though for some uses of mmap(), it *does* point at swap space (for instance,
the anonymous pages created by mmap() as used from malloc() in glibc).
-Neo
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies