From 83813267c699ab11cc65a6d9d0f42db42f0862b3 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 22 Mar 2011 16:32:48 -0700 Subject: mm: move anon_vma ref out from under CONFIG_foo We need the anon_vma refcount unconditionally to simplify the anon_vma lifetime rules. Signed-off-by: Peter Zijlstra Acked-by: Mel Gorman Reviewed-by: KAMEZAWA Hiroyuki Acked-by: Hugh Dickins Acked-by: Rik van Riel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/rmap.h | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) (limited to 'include') diff --git a/include/linux/rmap.h b/include/linux/rmap.h index b9b23ddca63a..fd56111a52c1 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -27,18 +27,15 @@ struct anon_vma { struct anon_vma *root; /* Root of this anon_vma tree */ spinlock_t lock; /* Serialize access to vma list */ -#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) - /* - * The external_refcount is taken by either KSM or page migration - * to take a reference to an anon_vma when there is no + * The refcount is taken on an anon_vma when there is no * guarantee that the vma of page tables will exist for * the duration of the operation. A caller that takes * the reference is responsible for clearing up the * anon_vma if they are the last user on release */ - atomic_t external_refcount; -#endif + atomic_t refcount; + /* * NOTE: the LSB of the head.next is set by * mm_take_all_locks() _after_ taking the above lock. So the @@ -71,41 +68,12 @@ struct anon_vma_chain { }; #ifdef CONFIG_MMU -#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) -static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma) -{ - atomic_set(&anon_vma->external_refcount, 0); -} - -static inline int anonvma_external_refcount(struct anon_vma *anon_vma) -{ - return atomic_read(&anon_vma->external_refcount); -} - static inline void get_anon_vma(struct anon_vma *anon_vma) { - atomic_inc(&anon_vma->external_refcount); + atomic_inc(&anon_vma->refcount); } void put_anon_vma(struct anon_vma *); -#else -static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma) -{ -} - -static inline int anonvma_external_refcount(struct anon_vma *anon_vma) -{ - return 0; -} - -static inline void get_anon_vma(struct anon_vma *anon_vma) -{ -} - -static inline void put_anon_vma(struct anon_vma *anon_vma) -{ -} -#endif /* CONFIG_KSM */ static inline struct anon_vma *page_anon_vma(struct page *page) { -- cgit v1.2.3