diff options
Diffstat (limited to 'include/linux/rmap.h')
-rw-r--r-- | include/linux/rmap.h | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index b019ae64e2ab..62da2001d55c 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -37,7 +37,27 @@ struct anon_vma { | |||
37 | * is serialized by a system wide lock only visible to | 37 | * is serialized by a system wide lock only visible to |
38 | * mm_take_all_locks() (mm_all_locks_mutex). | 38 | * mm_take_all_locks() (mm_all_locks_mutex). |
39 | */ | 39 | */ |
40 | struct list_head head; /* List of private "related" vmas */ | 40 | struct list_head head; /* Chain of private "related" vmas */ |
41 | }; | ||
42 | |||
43 | /* | ||
44 | * The copy-on-write semantics of fork mean that an anon_vma | ||
45 | * can become associated with multiple processes. Furthermore, | ||
46 | * each child process will have its own anon_vma, where new | ||
47 | * pages for that process are instantiated. | ||
48 | * | ||
49 | * This structure allows us to find the anon_vmas associated | ||
50 | * with a VMA, or the VMAs associated with an anon_vma. | ||
51 | * The "same_vma" list contains the anon_vma_chains linking | ||
52 | * all the anon_vmas associated with this VMA. | ||
53 | * The "same_anon_vma" list contains the anon_vma_chains | ||
54 | * which link all the VMAs associated with this anon_vma. | ||
55 | */ | ||
56 | struct anon_vma_chain { | ||
57 | struct vm_area_struct *vma; | ||
58 | struct anon_vma *anon_vma; | ||
59 | struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ | ||
60 | struct list_head same_anon_vma; /* locked by anon_vma->lock */ | ||
41 | }; | 61 | }; |
42 | 62 | ||
43 | #ifdef CONFIG_MMU | 63 | #ifdef CONFIG_MMU |
@@ -89,12 +109,19 @@ static inline void anon_vma_unlock(struct vm_area_struct *vma) | |||
89 | */ | 109 | */ |
90 | void anon_vma_init(void); /* create anon_vma_cachep */ | 110 | void anon_vma_init(void); /* create anon_vma_cachep */ |
91 | int anon_vma_prepare(struct vm_area_struct *); | 111 | int anon_vma_prepare(struct vm_area_struct *); |
92 | void __anon_vma_merge(struct vm_area_struct *, struct vm_area_struct *); | 112 | void unlink_anon_vmas(struct vm_area_struct *); |
93 | void anon_vma_unlink(struct vm_area_struct *); | 113 | int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); |
94 | void anon_vma_link(struct vm_area_struct *); | 114 | int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); |
95 | void __anon_vma_link(struct vm_area_struct *); | 115 | void __anon_vma_link(struct vm_area_struct *); |
96 | void anon_vma_free(struct anon_vma *); | 116 | void anon_vma_free(struct anon_vma *); |
97 | 117 | ||
118 | static inline void anon_vma_merge(struct vm_area_struct *vma, | ||
119 | struct vm_area_struct *next) | ||
120 | { | ||
121 | VM_BUG_ON(vma->anon_vma != next->anon_vma); | ||
122 | unlink_anon_vmas(next); | ||
123 | } | ||
124 | |||
98 | /* | 125 | /* |
99 | * rmap interfaces called when adding or removing pte of page | 126 | * rmap interfaces called when adding or removing pte of page |
100 | */ | 127 | */ |