mm: rename drop_anon_vma() to put_anon_vma()
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Tue, 22 Mar 2011 23:32:46 +0000 (16:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Mar 2011 00:44:03 +0000 (17:44 -0700)
The normal code pattern used in the kernel is: get/put.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/rmap.h
mm/ksm.c
mm/migrate.c
mm/rmap.c

index e9fd04ca1e518f9f6eeb0d430443a64e667722e4..b9b23ddca63af8da20f42a4a84764dc0e874764f 100644 (file)
@@ -87,7 +87,7 @@ static inline void get_anon_vma(struct anon_vma *anon_vma)
        atomic_inc(&anon_vma->external_refcount);
 }
 
-void drop_anon_vma(struct anon_vma *);
+void put_anon_vma(struct anon_vma *);
 #else
 static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
 {
@@ -102,7 +102,7 @@ static inline void get_anon_vma(struct anon_vma *anon_vma)
 {
 }
 
-static inline void drop_anon_vma(struct anon_vma *anon_vma)
+static inline void put_anon_vma(struct anon_vma *anon_vma)
 {
 }
 #endif /* CONFIG_KSM */
index c2b2a94f9d6773d1be1aece2387d6a6a52b1ae33..1bbe785aa559cb2f1c8bb87c329b4b9239b4d01d 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -301,20 +301,6 @@ static inline int in_stable_tree(struct rmap_item *rmap_item)
        return rmap_item->address & STABLE_FLAG;
 }
 
-static void hold_anon_vma(struct rmap_item *rmap_item,
-                         struct anon_vma *anon_vma)
-{
-       rmap_item->anon_vma = anon_vma;
-       get_anon_vma(anon_vma);
-}
-
-static void ksm_drop_anon_vma(struct rmap_item *rmap_item)
-{
-       struct anon_vma *anon_vma = rmap_item->anon_vma;
-
-       drop_anon_vma(anon_vma);
-}
-
 /*
  * ksmd, and unmerge_and_remove_all_rmap_items(), must not touch an mm's
  * page tables after it has passed through ksm_exit() - which, if necessary,
@@ -397,7 +383,7 @@ static void break_cow(struct rmap_item *rmap_item)
         * It is not an accident that whenever we want to break COW
         * to undo, we also need to drop a reference to the anon_vma.
         */
-       ksm_drop_anon_vma(rmap_item);
+       put_anon_vma(rmap_item->anon_vma);
 
        down_read(&mm->mmap_sem);
        if (ksm_test_exit(mm))
@@ -466,7 +452,7 @@ static void remove_node_from_stable_tree(struct stable_node *stable_node)
                        ksm_pages_sharing--;
                else
                        ksm_pages_shared--;
-               ksm_drop_anon_vma(rmap_item);
+               put_anon_vma(rmap_item->anon_vma);
                rmap_item->address &= PAGE_MASK;
                cond_resched();
        }
@@ -554,7 +540,7 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
                else
                        ksm_pages_shared--;
 
-               ksm_drop_anon_vma(rmap_item);
+               put_anon_vma(rmap_item->anon_vma);
                rmap_item->address &= PAGE_MASK;
 
        } else if (rmap_item->address & UNSTABLE_FLAG) {
@@ -949,7 +935,8 @@ static int try_to_merge_with_ksm_page(struct rmap_item *rmap_item,
                goto out;
 
        /* Must get reference to anon_vma while still holding mmap_sem */
-       hold_anon_vma(rmap_item, vma->anon_vma);
+       rmap_item->anon_vma = vma->anon_vma;
+       get_anon_vma(vma->anon_vma);
 out:
        up_read(&mm->mmap_sem);
        return err;
index 8aacce3af8cd5b30526cf39b724c5be06c6cb518..7d2983f3783e0ee1addced945a093303f9ac5629 100644 (file)
@@ -764,7 +764,7 @@ skip_unmap:
 
        /* Drop an anon_vma reference if we took one */
        if (anon_vma)
-               drop_anon_vma(anon_vma);
+               put_anon_vma(anon_vma);
 
 uncharge:
        if (!charge)
@@ -856,7 +856,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
                remove_migration_ptes(hpage, hpage);
 
        if (anon_vma)
-               drop_anon_vma(anon_vma);
+               put_anon_vma(anon_vma);
 out:
        unlock_page(hpage);
 
index 941bf82e896128b618284ae17a25d963c13838fc..ad416afb2061fb4eb6b85a0b5be907c11690a211 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -278,7 +278,7 @@ static void anon_vma_unlink(struct anon_vma_chain *anon_vma_chain)
        if (empty) {
                /* We no longer need the root anon_vma */
                if (anon_vma->root != anon_vma)
-                       drop_anon_vma(anon_vma->root);
+                       put_anon_vma(anon_vma->root);
                anon_vma_free(anon_vma);
        }
 }
@@ -1493,7 +1493,7 @@ int try_to_munlock(struct page *page)
  * we know we are the last user, nobody else can get a reference and we
  * can do the freeing without the lock.
  */
-void drop_anon_vma(struct anon_vma *anon_vma)
+void put_anon_vma(struct anon_vma *anon_vma)
 {
        BUG_ON(atomic_read(&anon_vma->external_refcount) <= 0);
        if (atomic_dec_and_lock(&anon_vma->external_refcount, &anon_vma->root->lock)) {