From: http://blog.csdn.net/hongchangfirst
The last time we talked about the Linux Process descriptor, this time we are talking about the memory descriptor. the Linux memory descriptor is also represented by a struct, specifically the mm_struct struct, which is defined in Linux/mm_types.h. The Linux operating system uses this struct to manage the memory. Let's take a look at the specific field information.
Struct mm_struct {// unsigned long task_size of the virtual address space of the process that owns the struct;/* If non-zero, the largest hole below free_area_cache */unsigned long cached_hole_size; /* First hole of size cached_hole_size or larger */unsigned long free_area_cache; // how many users use this memory atomic_t mm_users in the user space;/* How many users with user space? * /// The reference count value of this struct atomic_t mm_count;/* The list_head is displayed again. For details, see. In simple terms, list_head, list_for_each, and list_entry implement the linked list of their "contained objects. */Struct list_head mmlist;/* The following is about the code segment, data segment, stack, environment variable, start address or end address of the parameter */unsigned long total_vm, locked_vm, shared_vm, exec_vm; unsigned long stack_vm, counts, def_flags, counts; unsigned long start_code, end_code, start_data, end_data; unsigned long counts, BRK, start_stack; unsigned long arg_start, arg_end, env_start, env_end; /** last value of global fault stamp as seen by this process. * In other words, this value gives an indication of how long * It has been since this task got the token. * Look at mm/thrash. C */unsigned int faultstamp; unsigned int token_priority; unsigned int last_interval ;};
This struct can be obtained through the process descriptor. For example, if current is the descriptor of the current process, current-> MM is the pointer to memory. Mm is a pointer to struct mm_struct. For more information about Linux Process descriptors, see task_struct.