diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/rmap.h | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 567d43f29a10..77216742c178 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -26,11 +26,17 @@ | |||
26 | */ | 26 | */ |
27 | struct anon_vma { | 27 | struct anon_vma { |
28 | spinlock_t lock; /* Serialize access to vma list */ | 28 | spinlock_t lock; /* Serialize access to vma list */ |
29 | #ifdef CONFIG_KSM | 29 | #if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) |
30 | atomic_t ksm_refcount; | 30 | |
31 | #endif | 31 | /* |
32 | #ifdef CONFIG_MIGRATION | 32 | * The external_refcount is taken by either KSM or page migration |
33 | atomic_t migrate_refcount; | 33 | * to take a reference to an anon_vma when there is no |
34 | * guarantee that the vma of page tables will exist for | ||
35 | * the duration of the operation. A caller that takes | ||
36 | * the reference is responsible for clearing up the | ||
37 | * anon_vma if they are the last user on release | ||
38 | */ | ||
39 | atomic_t external_refcount; | ||
34 | #endif | 40 | #endif |
35 | /* | 41 | /* |
36 | * NOTE: the LSB of the head.next is set by | 42 | * NOTE: the LSB of the head.next is set by |
@@ -64,46 +70,26 @@ struct anon_vma_chain { | |||
64 | }; | 70 | }; |
65 | 71 | ||
66 | #ifdef CONFIG_MMU | 72 | #ifdef CONFIG_MMU |
67 | #ifdef CONFIG_KSM | 73 | #if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) |
68 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | 74 | static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma) |
69 | { | 75 | { |
70 | atomic_set(&anon_vma->ksm_refcount, 0); | 76 | atomic_set(&anon_vma->external_refcount, 0); |
71 | } | 77 | } |
72 | 78 | ||
73 | static inline int ksm_refcount(struct anon_vma *anon_vma) | 79 | static inline int anonvma_external_refcount(struct anon_vma *anon_vma) |
74 | { | 80 | { |
75 | return atomic_read(&anon_vma->ksm_refcount); | 81 | return atomic_read(&anon_vma->external_refcount); |
76 | } | 82 | } |
77 | #else | 83 | #else |
78 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | 84 | static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma) |
79 | { | 85 | { |
80 | } | 86 | } |
81 | 87 | ||
82 | static inline int ksm_refcount(struct anon_vma *anon_vma) | 88 | static inline int anonvma_external_refcount(struct anon_vma *anon_vma) |
83 | { | 89 | { |
84 | return 0; | 90 | return 0; |
85 | } | 91 | } |
86 | #endif /* CONFIG_KSM */ | 92 | #endif /* CONFIG_KSM */ |
87 | #ifdef CONFIG_MIGRATION | ||
88 | static inline void migrate_refcount_init(struct anon_vma *anon_vma) | ||
89 | { | ||
90 | atomic_set(&anon_vma->migrate_refcount, 0); | ||
91 | } | ||
92 | |||
93 | static inline int migrate_refcount(struct anon_vma *anon_vma) | ||
94 | { | ||
95 | return atomic_read(&anon_vma->migrate_refcount); | ||
96 | } | ||
97 | #else | ||
98 | static inline void migrate_refcount_init(struct anon_vma *anon_vma) | ||
99 | { | ||
100 | } | ||
101 | |||
102 | static inline int migrate_refcount(struct anon_vma *anon_vma) | ||
103 | { | ||
104 | return 0; | ||
105 | } | ||
106 | #endif /* CONFIG_MIGRATE */ | ||
107 | 93 | ||
108 | static inline struct anon_vma *page_anon_vma(struct page *page) | 94 | static inline struct anon_vma *page_anon_vma(struct page *page) |
109 | { | 95 | { |