Skip to Main Content
Understanding the Linux Kernel
book

Understanding the Linux Kernel

by Daniel P. Bovet, Marco Cesati
October 2000
Intermediate to advanced content levelIntermediate to advanced
704 pages
18h 13m
English
O'Reilly Media, Inc.
Content preview from Understanding the Linux Kernel

7.2. The Memory Descriptor

All information related to the process address space is included in a table referenced by the mm field of the process descriptor. This table is a structure of type mm_struct as follows:

struct mm_struct { 
    struct vm_area_struct *mmap, *mmap_avl, *mmap_cache; 
    pgd_t * pgd; 
    atomic_t count; 
    int map_count; 
    struct semaphore mmap_sem; 
    unsigned long context; 
    unsigned long start_code, end_code, start_data, end_data; 
    unsigned long start_brk, brk, start_stack; 
    unsigned long arg_start, arg_end, env_start, env_end; 
    unsigned long rss, total_vm, locked_vm; 
    unsigned long def_flags; 
    unsigned long cpu_vm_mask; 
    unsigned long swap_cnt; 
    unsigned long swap_address; 
    void * segments; 
};

For the present discussion, the most important fields are:

pgd and segments

Point, respectively, to the Page Global Directory and Local Descriptor Table of the process.

rss

Specifies the number of page frames allocated to the process.

total_vm

Denotes the size of the process address space expressed as a number of pages.

locked_vm

Counts the number of "locked" pages, that is, pages that cannot be swapped out (see Chapter 16).

count

Denotes the number of processes that share the same struct mm_struct descriptor. If count is greater than 1, the processes are lightweight processes sharing the same address space, that is, using the same memory descriptor.

The mm_alloc( ) function is invoked to get a new memory descriptor. Since these descriptors are stored in a slab allocator cache, mm_alloc( ) ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Kernel in a Nutshell

Linux Kernel in a Nutshell

Greg Kroah-Hartman
Linux Kernel Debugging

Linux Kernel Debugging

Kaiwan N. Billimoria
Understanding the Linux Kernel, 3rd Edition

Understanding the Linux Kernel, 3rd Edition

Daniel P. Bovet, Marco Cesati

Publisher Resources

ISBN: 0596000022Catalog PageErrata