Analysis of Data Structure in Linux - Original Reprint Please notify

xiaoxiao2021-03-06  24

Data Structure Analysis of Physical Page Page

Typedef struct Page {

Struct list_head list;

Struct Address_Space * mapping;

Unsigned long index; / * If the page belongs to a file, representing the serial number in the file; page content is swapped on the switched device, but the content is reserved, indicating the page. * /

Struct Page * Next_hash;

Atomic_t count; / * Indicates the number of page shared processes, the operation of this attribute must be atomic * /

Unsigned long flags; / * This logo is used for I / O sync * /

Struct List_head Lru; / * Indicates which list of the current belonging * /

Unsigned long age; / * The age of the page, when you change it out, as a reference * /

WAIT_QUENCE_HEAD_T WATI; / * Wait for the queue pointer * /

Struct Page ** PPREV_HASH;

Struct buffer_head * buffer; / * If the page is used as a buffer, the address * /

Void * Virtul;

Struct zone_struct zone; / * Indicates the page in that management area * /

} MEM_MAP_T;

MM_STRUCT structure

The mm_struct structure is used to describe a virtual memory of a process, which is described in /include/linux/sched.h:

Struct mm_struct {

Struct vm_area_struct mmap; / * Used to create a single link linear queue for a virtual space structure * /

Struct VM_Area_struct mmap_avl; / * Create an AVL tree of a virtual space structure * /

Struct VM_Area_struct mmap_cache; / * Points the structure of the virtual space for the last use * /

PGD_T * PGD; / * Page directory of the process

Atomic_t mm_users;

Atomic_t mm_count; / * and the previous attribute together, MM_STRUCT is set by other process sharing * /

INT map_count;

Struct Semaphore Mmap_sem; / * Mutual exclusion signal for MMAP operation * /

Spinlock_t page_table_lock;

Struct list_head mmlist;

Unsigned long start_code, end_code, start_data, end_data; / * code, starting * /

Unsigned long start_brk, brk, start_stack; / * Starting * /

Unsigned long arg_start, arg_end, env_start, env_end; / * Store process parameter location, starting position of environment variable * /

Unsigned long RSS, Total_VM, Locked_VM;

Unsigned long def_flags;

UNSIGNED long CPU_VM_MASK;

Unsigned long swap_cnt; / * Reflecting a process of a process that has not been visited in a rotational page of the page * /

Unsigned long swap_address;

MM_CONTEXT_T CONTEXT; / * The context of the process, uses * /} during the process switching;

VM_AREA_STRUCT describes a virtual address area of ​​a process, which is described in /include/linux/mm.h:

Struct vm_area_struct {

Struct mm_struct * vm_mm; / * Virtual Interval Parameter * /

UNSIGNED long VM_Start; / * The start address of the virtual memory interval contains * / unsigned long VM_END; / * The end address of the virtual memory interval is not included in the dummy interval * /

Struct VM_Area_struct * vm_next; / * Connect the same process but has different permissions * /

PGPROT_T VM_PAGE_PROT; / * Access * /

Unsigned long vm_flags; / * attribute * /

Short VM_AVL_HEIGHT; / * AVL Tree High * /

STRUCT VM_AREA_STRUCT * VM_AVL_LEFT; / * Left sub-tree * /

Struct VM_Area_Struct * VM_AVL_RIGHT; / * Right sub-tree * /

Struct VM_Area_struct * vm_next_shart;

Struct vm_area_struct ** vm_pprev_share;

Struct vm_operations_struct * vm_ops; / * Describes the operation on this dummy interval * /

Unsigned long vm_pgoff;

Struct file * vm_file; / * and the next property together for recording and managing contact with disk files * /

Unsigned long VM_RAEND;

Void * vm_private_data;};

Struct vm_area_struct {

Struct mm_struct * vm_mm; / * Virtual Interval Parameter * /

UNSIGNED long vm_start; / * The start address of the virtual memory section is included in the dummy room * /

Unsigned long VM_END; / * The end address of the virtual memory interval is not included in the dummy interval * /

Struct VM_Area_struct * vm_next; / * Connect the same process but has different permissions * /

PGPROT_T VM_PAGE_PROT; / * Access * /

Unsigned long vm_flags; / * attribute * /

Short VM_AVL_HEIGHT; / * AVL Tree High * /

STRUCT VM_AREA_STRUCT * VM_AVL_LEFT; / * Left sub-tree * /

Struct VM_Area_Struct * VM_AVL_RIGHT; / * Right sub-tree * /

Struct VM_Area_struct * vm_next_shart;

Struct vm_area_struct ** vm_pprev_share;

Struct vm_operations_struct * vm_ops; / * Describes the operation on this dummy interval * /

Unsigned long vm_pgoff;

Struct file * vm_file; / * and the next property together for recording and managing contact with disk files * /

Unsigned long VM_RAEND;

Void * vm_private_data;};

转载请注明原文地址:https://www.9cbs.com/read-39971.html

New Post(0)