vm_area_struct成员

vm_area_struct成员

Content #

struct vm_area_struct {
  /* The first cache line has the info for VMA tree walking. */
  unsigned long vm_start;    /* Our start address within vm_mm. */
  unsigned long vm_end;    /* The first byte after our end address within vm_mm. */
  /* linked list of VM areas per task, sorted by address */
  struct vm_area_struct *vm_next, *vm_prev;
  struct rb_node vm_rb;
  struct mm_struct *vm_mm;  /* The address space we belong to. */
  struct list_head anon_vma_chain; /* Serialized by mmap_sem &
            * page_table_lock */
  struct anon_vma *anon_vma;  /* Serialized by page_table_lock */
  /* Function pointers to deal with this struct. */
  const struct vm_operations_struct *vm_ops;
  struct file * vm_file;    /* File we map to (can be NULL). */
  void * vm_private_data;    /* was vm_pte (shared mem) */
} __randomize_layout;

vm_start 和 vm_end 指定了该区域在用户空间中的起始和结束地址。 vm_next 和 vm_prev 将这个区域串在链表上。 vm_rb 将这个区域放在红黑树上。 vm_ops 里面是对这个内存区域可以做的操作的定义。

虚拟内存区域可以映射到物理内存,这时候称为匿名映射,anon_vma 中,anoy 就是 anonymous,匿名的意思。

也可以映射到文件,映射到文件就需要有 vm_file 指定被映射的文件。

Viewpoints #

From #

22 | 进程空间管理:项目组还可以自行布置会议室