]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
thp: share get_huge_page_tail()
authorAndrea Arcangeli <aarcange@redhat.com>
Mon, 24 Oct 2011 14:54:24 +0000 (01:54 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 25 Oct 2011 09:07:48 +0000 (20:07 +1100)
This avoids duplicating the function in every arch gup_fast.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <jweiner@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/powerpc/mm/hugetlbpage.c
arch/s390/mm/gup.c
arch/sparc/mm/gup.c
arch/x86/mm/gup.c
include/linux/mm.h

index 3b669fd0bef3b578fabef9dc5d01c4f1dbb8d771..5964371303ac4a5941eb2a0ccceca27cf6330354 100644 (file)
@@ -609,17 +609,6 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
        return NULL;
 }
 
-static inline void get_huge_page_tail(struct page *page)
-{
-       /*
-        * __split_huge_page_refcount() cannot run
-        * from under us.
-        */
-       VM_BUG_ON(page_mapcount(page) < 0);
-       VM_BUG_ON(atomic_read(&page->_count) != 0);
-       atomic_inc(&page->_mapcount);
-}
-
 static noinline int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
                       unsigned long end, int write, struct page **pages, int *nr)
 {
index da33a0281d9dbccc3444a2305b6a3ff4bff9d39f..65cb06e2af4eaa0a7b18b2e3b0f5b4b1af8be9d8 100644 (file)
@@ -48,17 +48,6 @@ static inline int gup_pte_range(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
        return 1;
 }
 
-static inline void get_huge_page_tail(struct page *page)
-{
-       /*
-        * __split_huge_page_refcount() cannot run
-        * from under us.
-        */
-       VM_BUG_ON(page_mapcount(page) < 0);
-       VM_BUG_ON(atomic_read(&page->_count) != 0);
-       atomic_inc(&page->_mapcount);
-}
-
 static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
                unsigned long end, int write, struct page **pages, int *nr)
 {
index afcebac144fb7b5f5cf2b4318fff8234d64a7cb1..42c55df3aec300b5baee79e6af5123ab99c7b126 100644 (file)
 #include <linux/rwsem.h>
 #include <asm/pgtable.h>
 
-static inline void get_huge_page_tail(struct page *page)
-{
-       /*
-        * __split_huge_page_refcount() cannot run
-        * from under us.
-        */
-       VM_BUG_ON(page_mapcount(page) < 0);
-       VM_BUG_ON(atomic_read(&page->_count) != 0);
-       atomic_inc(&page->_mapcount);
-}
-
 /*
  * The performance critical leaf functions are made noinline otherwise gcc
  * inlines everything into a single function which results in too much
index 3b5032a62b0f3e41c98b98c0842500215e9e3e18..ea305856151cefc62fccd7f216519bc9d5f2945c 100644 (file)
@@ -108,17 +108,6 @@ static inline void get_head_page_multiple(struct page *page, int nr)
        SetPageReferenced(page);
 }
 
-static inline void get_huge_page_tail(struct page *page)
-{
-       /*
-        * __split_huge_page_refcount() cannot run
-        * from under us.
-        */
-       VM_BUG_ON(page_mapcount(page) < 0);
-       VM_BUG_ON(atomic_read(&page->_count) != 0);
-       atomic_inc(&page->_mapcount);
-}
-
 static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr,
                unsigned long end, int write, struct page **pages, int *nr)
 {
index 95426cdc396ef5c04ff80c47dde8894653c09e98..4baadd18f4ad3402f47fbd2ac919bafba519bed4 100644 (file)
@@ -377,6 +377,17 @@ static inline int page_count(struct page *page)
        return atomic_read(&compound_head(page)->_count);
 }
 
+static inline void get_huge_page_tail(struct page *page)
+{
+       /*
+        * __split_huge_page_refcount() cannot run
+        * from under us.
+        */
+       VM_BUG_ON(page_mapcount(page) < 0);
+       VM_BUG_ON(atomic_read(&page->_count) != 0);
+       atomic_inc(&page->_mapcount);
+}
+
 extern bool __get_page_tail(struct page *page);
 
 static inline void get_page(struct page *page)