This session will talk about the Linux Virtual Memory (VM) subsystem. In particular, we will be looking at a number of changes in the way things work since the 1.2 kernels - the new, streamlined 2.0 VM system has a number of substantial improvements over the old system, offering a cleaner mechanism with much better performance and functionality than older kernels.
First of all, we will look at the functionality managed by the VM system. The principle of VM will be familiar to many readers: the operating system allows many different processes each to see their own partition of CPU memory. Memory owned by one process is invisible to another. Further more, we are dealing with virtual memory: a page of memory owned by one process need not correspond to exactly one page of physical memory. Unused process memory may be evicted to disk, and many different processes may each be able to see a single page of memory at once. Finally, the VM system supports memory mapping: a file on disk may be mapped into memory so that a process may access and modify the file simply by reading and writing a range of memory.
The basic structure by which this is managed has changed significantly since the 1.2 kernels. On 1.2, the filesystem and VM systems were entirely separate components of the kernel. Caching within the filesystem was dealt with by a dedicated buffer cache, and the VM system maintained its pages in separate areas of memory. The only concession to page sharing was that a properly aligned set of buffers was permitted to be mapped, read-only, into a process' address space to provide a restricted (but still very useful) form of memory mapping. The buffer cache and VM systems had their own separate interfaces into the block device IO system, with the buffer cache being tied very closely to block devices. In the 1.3.50 kernels, a new structure appeared: the page cache. As its name suggests, the page cache stores entire pages of file data at once. However, unlike the buffer cache it is not limited to caching block device contents. It gives a number of advantages over the simpler, single-cache system in the 1.2 kernels: