Re: mmap confusion

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

 



On Mon, 20 Sep 2010 07:33:05 +0200, Rajat Jain <rajatjain@xxxxxxxxxxx> wrote:

1) If the backing file is /dev/mem or a device file, then at the time of mmap(),
the page table entries / TLB entries are set up such that the virtual address in
the user space, maps to the actual physical address desired. And the thus job
is done. This case is clear.

Page table entries don't need to be set immediately but essentially that is the
case.

2) The other case is that when the file is actually a datafile present in a file
system lets say on a SATA disk. Now, for each load / store in the application,
some driver code needs to trigger that will program the SATA controller registers
and do n number of thinks to initiate the diska read / write transaction. How is
this achieved? Because application is not making any System calls. Its just having
load / store instructions.

When a "normal" file is mapped no page entries are set.  As an effect, when user
space refers to the mapped area a page fault is triggered.  This is handled by
kernel which reads a page from the disk and adds a proper page table entry.

On writes, such a page is marked as dirty (either CPU supports that directly,
or kernel simulates it by setting page read-only so that on write an page fault
is generated again).  When process terminates all dirty pages are written back to
disk.

--
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  MichaÅ "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs


[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux