mmap doubt??

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

 



Hello all,

I have some doubt regarding mmap function...

 As it is a known fact that when a file is mmap'd at that time no
physical memory is allocated and when the process tries to accesses
the data of mmap'd file at that time "page fault" occurs  and then the
data is brought from disk to RAM.
This is what is called as demand

But while reading about mmap I found that  call to mmap eventually
leads invocation of "do_mmap_pgoff()" which allocates the vma area for
the file to be mmap'd .

The do_mmap_pgoff() make calls to make_pages_present() which in turn
calls get_user_pages()....

This get_user_pages() does the page fault and brings the file data
from disk to pages in VMA in process address space...

So if this is the flow  then the file data is already in pages in RAM
at the end of mmap function(get_user_pages does that!!)....

I am really confused here....what is demand paging then in case of
mmap???  Because the file data is already brought in memory during
call to mmap....

Please help!!!

-Adheer

--
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