Cc: Ingo Molnar <mi...@kernel.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Rik van Riel <r...@redhat.com>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Cc: Michel Lespinasse <wal...@google.com>
Signed-off-by: Yuanhan Liu <yuanhan....@linux.intel.com>
---
 mm/rmap.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 246b5fe..831dd4e 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -67,19 +67,7 @@ static struct kmem_cache *anon_vma_chain_cachep;
 
 static inline struct anon_vma *anon_vma_alloc(void)
 {
-       struct anon_vma *anon_vma;
-
-       anon_vma = kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL);
-       if (anon_vma) {
-               atomic_set(&anon_vma->refcount, 1);
-               /*
-                * Initialise the anon_vma root to point to itself. If called
-                * from fork, the root will be reset to the parents anon_vma.
-                */
-               anon_vma->root = anon_vma;
-       }
-
-       return anon_vma;
+       return kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL);
 }
 
 static inline void anon_vma_free(struct anon_vma *anon_vma)
@@ -293,8 +281,15 @@ static void anon_vma_ctor(void *data)
        struct anon_vma *anon_vma = data;
 
        rwlock_init(&anon_vma->rwlock);
-       atomic_set(&anon_vma->refcount, 0);
        anon_vma->rb_root = RB_ROOT;
+
+       atomic_set(&anon_vma->refcount, 1);
+       /*
+        * Initialise the anon_vma root to point to itself. If called
+        * from fork, the root will be reset to the parents anon_vma.
+        */
+       anon_vma->root = anon_vma;
+
 }
 
 void __init anon_vma_init(void)
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to