diff options
Diffstat (limited to 'include/linux/rmap.h')
| -rw-r--r-- | include/linux/rmap.h | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 830e65dc01ee..2148b122779b 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
| 8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
| 9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
| 10 | #include <linux/spinlock.h> | 10 | #include <linux/mutex.h> |
| 11 | #include <linux/memcontrol.h> | 11 | #include <linux/memcontrol.h> |
| 12 | 12 | ||
| 13 | /* | 13 | /* |
| @@ -26,7 +26,7 @@ | |||
| 26 | */ | 26 | */ |
| 27 | struct anon_vma { | 27 | struct anon_vma { |
| 28 | struct anon_vma *root; /* Root of this anon_vma tree */ | 28 | struct anon_vma *root; /* Root of this anon_vma tree */ |
| 29 | spinlock_t lock; /* Serialize access to vma list */ | 29 | struct mutex mutex; /* Serialize access to vma list */ |
| 30 | /* | 30 | /* |
| 31 | * The refcount is taken on an anon_vma when there is no | 31 | * The refcount is taken on an anon_vma when there is no |
| 32 | * guarantee that the vma of page tables will exist for | 32 | * guarantee that the vma of page tables will exist for |
| @@ -64,7 +64,7 @@ struct anon_vma_chain { | |||
| 64 | struct vm_area_struct *vma; | 64 | struct vm_area_struct *vma; |
| 65 | struct anon_vma *anon_vma; | 65 | struct anon_vma *anon_vma; |
| 66 | struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ | 66 | struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ |
| 67 | struct list_head same_anon_vma; /* locked by anon_vma->lock */ | 67 | struct list_head same_anon_vma; /* locked by anon_vma->mutex */ |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | #ifdef CONFIG_MMU | 70 | #ifdef CONFIG_MMU |
| @@ -93,24 +93,24 @@ static inline void vma_lock_anon_vma(struct vm_area_struct *vma) | |||
| 93 | { | 93 | { |
| 94 | struct anon_vma *anon_vma = vma->anon_vma; | 94 | struct anon_vma *anon_vma = vma->anon_vma; |
| 95 | if (anon_vma) | 95 | if (anon_vma) |
| 96 | spin_lock(&anon_vma->root->lock); | 96 | mutex_lock(&anon_vma->root->mutex); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static inline void vma_unlock_anon_vma(struct vm_area_struct *vma) | 99 | static inline void vma_unlock_anon_vma(struct vm_area_struct *vma) |
| 100 | { | 100 | { |
| 101 | struct anon_vma *anon_vma = vma->anon_vma; | 101 | struct anon_vma *anon_vma = vma->anon_vma; |
| 102 | if (anon_vma) | 102 | if (anon_vma) |
| 103 | spin_unlock(&anon_vma->root->lock); | 103 | mutex_unlock(&anon_vma->root->mutex); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | static inline void anon_vma_lock(struct anon_vma *anon_vma) | 106 | static inline void anon_vma_lock(struct anon_vma *anon_vma) |
| 107 | { | 107 | { |
| 108 | spin_lock(&anon_vma->root->lock); | 108 | mutex_lock(&anon_vma->root->mutex); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static inline void anon_vma_unlock(struct anon_vma *anon_vma) | 111 | static inline void anon_vma_unlock(struct anon_vma *anon_vma) |
| 112 | { | 112 | { |
| 113 | spin_unlock(&anon_vma->root->lock); | 113 | mutex_unlock(&anon_vma->root->mutex); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | /* | 116 | /* |
| @@ -218,20 +218,7 @@ int try_to_munlock(struct page *); | |||
| 218 | /* | 218 | /* |
| 219 | * Called by memory-failure.c to kill processes. | 219 | * Called by memory-failure.c to kill processes. |
| 220 | */ | 220 | */ |
| 221 | struct anon_vma *__page_lock_anon_vma(struct page *page); | 221 | struct anon_vma *page_lock_anon_vma(struct page *page); |
| 222 | |||
| 223 | static inline struct anon_vma *page_lock_anon_vma(struct page *page) | ||
| 224 | { | ||
| 225 | struct anon_vma *anon_vma; | ||
| 226 | |||
| 227 | __cond_lock(RCU, anon_vma = __page_lock_anon_vma(page)); | ||
| 228 | |||
| 229 | /* (void) is needed to make gcc happy */ | ||
| 230 | (void) __cond_lock(&anon_vma->root->lock, anon_vma); | ||
| 231 | |||
| 232 | return anon_vma; | ||
| 233 | } | ||
| 234 | |||
| 235 | void page_unlock_anon_vma(struct anon_vma *anon_vma); | 222 | void page_unlock_anon_vma(struct anon_vma *anon_vma); |
| 236 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); | 223 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); |
| 237 | 224 | ||
