Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 4: Virtual Process Memory


Backing
Store

Virtual
address space

Addres space region

Physical page
frames

Not mapped, in use

Mapped, in use

Not mapped, not in use

Page tables

Figure 4-5: Interaction of data structures during demand paging.

❑ A process tries to access a memory address that is in user address space but cannot be resolved
using the page tables (there is no associated page in RAM memory).
❑ The processor then triggers a page fault that is forwarded to the kernel.
❑ The kernel runs through the process address space data structures responsible for the area in
which the fault occurred to find the appropriate backing store or to establish that access was,
indeed, incorrect.
❑ A physical page is allocated and filled with the requisite data from the backing store.
❑ The physical page is incorporated into the address space of the user process with the help of the
page tables, and the application resumes.

These actions are transparent to user processes; in other words, the processes don’t notice whether a page
is actually available or must first be requested by means of demand paging.

4.4 Data Structures


Recall thatstruct mm_structis important — it provides all necessary information to lay out a task in
memory as discussed before. Additionally, it includes the following elements for management of all
memory regions in the virtual address space of a user process.

<mm_types.h>
struct mm_struct {
struct vm_area_struct * mmap; /* list of VMAs */
struct rb_root mm_rb;
struct vm_area_struct * mmap_cache; /* last find_vma result */
...
}

The following sections discuss the meanings of the entries.
Free download pdf