LWN.net Logo

The object-based reverse-mapping VM

The object-based reverse-mapping VM

Posted Feb 27, 2003 19:44 UTC (Thu) by giraffedata (subscriber, #1954)
Parent article: The object-based reverse-mapping VM

Just a comment on clear terminology:

The professor who first taught me what virtual memory is emphasized that we must never confuse pages with page frames, and over the years I've seen his wisdom. A page is a bunch of bytes of data. A page frame is an area of real memory that can hold a page.

A virtual memory system has a lot more pages than it has page frames.

A Linux 'struct page' describes a page frame, not a page. A page table entry, among other things, describes a page.


(Log in to post comments)

The object-based reverse-mapping VM

Posted Feb 28, 2003 9:09 UTC (Fri) by IkeTo (subscriber, #2122) [Link]

>A Linux 'struct page' describes a page frame, not a page. A page table entry,
>among other things, describes a page.

I teach operating systems as well, and so I'm the kind of people who insists that people should use the right terminology. ;p

A page table entry describes *both* a page and a frame, so the above statement is quite misleading. In particular, a page table is a mapping from pages to frames in case the frame is really in physical memory. For those pages that are not yet created in physical memory, a page table says nearly nothing about it. So it is more a frame thing than a page thing.

In Linux, memory of the system is described by a "mm_struct" memory descriptor. The descriptor has two important part: the physical part, which includes the page table described above (about the frames), and the logical part, which includes something called a "VM area struct". Such a vm_area_struct is the thing that really know what to do when a page that has no frame is accessed. In particular, it knows whether that the page is mapped to some disk file, so that whenever read the disk should be loaded; or that the page is mapped to some device, so the device driver should be called to generate the page content; or that the page is on copy-on-write, which means that the kernel must make a copy to the read-only frame that is written into; etc.

Of course there is the second half of the story, which is about the swap. This time the page table really have the information about it. In particular, the "swapped-out page identifier". It is used to hold information about "where is the page stored in the swap?". If you treat swap as extension to the physical frames, it is natural that it is store in the page table: because it is something about the physical frames (indeed its extension), not about the logical page.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds