]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.1.1/thp-share-get_huge_page_tail.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.1.1 / thp-share-get_huge_page_tail.patch
1 From b35a35b556f5e6b7993ad0baf20173e75c09ce8c Mon Sep 17 00:00:00 2001
2 From: Andrea Arcangeli <aarcange@redhat.com>
3 Date: Wed, 2 Nov 2011 13:37:36 -0700
4 Subject: thp: share get_huge_page_tail()
5
6 From: Andrea Arcangeli <aarcange@redhat.com>
7
8 commit b35a35b556f5e6b7993ad0baf20173e75c09ce8c upstream.
9
10 This avoids duplicating the function in every arch gup_fast.
11
12 Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
13 Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
14 Cc: Hugh Dickins <hughd@google.com>
15 Cc: Johannes Weiner <jweiner@redhat.com>
16 Cc: Rik van Riel <riel@redhat.com>
17 Cc: Mel Gorman <mgorman@suse.de>
18 Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
19 Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
20 Cc: David Gibson <david@gibson.dropbear.id.au>
21 Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
22 Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
23 Cc: David Miller <davem@davemloft.net>
24 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
25 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
27
28 ---
29 arch/powerpc/mm/hugetlbpage.c | 11 -----------
30 arch/s390/mm/gup.c | 11 -----------
31 arch/sparc/mm/gup.c | 11 -----------
32 arch/x86/mm/gup.c | 11 -----------
33 include/linux/mm.h | 11 +++++++++++
34 5 files changed, 11 insertions(+), 44 deletions(-)
35
36 --- a/arch/powerpc/mm/hugetlbpage.c
37 +++ b/arch/powerpc/mm/hugetlbpage.c
38 @@ -385,17 +385,6 @@ follow_huge_pmd(struct mm_struct *mm, un
39 return NULL;
40 }
41
42 -static inline void get_huge_page_tail(struct page *page)
43 -{
44 - /*
45 - * __split_huge_page_refcount() cannot run
46 - * from under us.
47 - */
48 - VM_BUG_ON(page_mapcount(page) < 0);
49 - VM_BUG_ON(atomic_read(&page->_count) != 0);
50 - atomic_inc(&page->_mapcount);
51 -}
52 -
53 static noinline int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
54 unsigned long end, int write, struct page **pages, int *nr)
55 {
56 --- a/arch/s390/mm/gup.c
57 +++ b/arch/s390/mm/gup.c
58 @@ -48,17 +48,6 @@ static inline int gup_pte_range(pmd_t *p
59 return 1;
60 }
61
62 -static inline void get_huge_page_tail(struct page *page)
63 -{
64 - /*
65 - * __split_huge_page_refcount() cannot run
66 - * from under us.
67 - */
68 - VM_BUG_ON(page_mapcount(page) < 0);
69 - VM_BUG_ON(atomic_read(&page->_count) != 0);
70 - atomic_inc(&page->_mapcount);
71 -}
72 -
73 static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
74 unsigned long end, int write, struct page **pages, int *nr)
75 {
76 --- a/arch/sparc/mm/gup.c
77 +++ b/arch/sparc/mm/gup.c
78 @@ -12,17 +12,6 @@
79 #include <linux/rwsem.h>
80 #include <asm/pgtable.h>
81
82 -static inline void get_huge_page_tail(struct page *page)
83 -{
84 - /*
85 - * __split_huge_page_refcount() cannot run
86 - * from under us.
87 - */
88 - VM_BUG_ON(page_mapcount(page) < 0);
89 - VM_BUG_ON(atomic_read(&page->_count) != 0);
90 - atomic_inc(&page->_mapcount);
91 -}
92 -
93 /*
94 * The performance critical leaf functions are made noinline otherwise gcc
95 * inlines everything into a single function which results in too much
96 --- a/arch/x86/mm/gup.c
97 +++ b/arch/x86/mm/gup.c
98 @@ -108,17 +108,6 @@ static inline void get_head_page_multipl
99 SetPageReferenced(page);
100 }
101
102 -static inline void get_huge_page_tail(struct page *page)
103 -{
104 - /*
105 - * __split_huge_page_refcount() cannot run
106 - * from under us.
107 - */
108 - VM_BUG_ON(page_mapcount(page) < 0);
109 - VM_BUG_ON(atomic_read(&page->_count) != 0);
110 - atomic_inc(&page->_mapcount);
111 -}
112 -
113 static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr,
114 unsigned long end, int write, struct page **pages, int *nr)
115 {
116 --- a/include/linux/mm.h
117 +++ b/include/linux/mm.h
118 @@ -376,6 +376,17 @@ static inline int page_count(struct page
119 return atomic_read(&compound_head(page)->_count);
120 }
121
122 +static inline void get_huge_page_tail(struct page *page)
123 +{
124 + /*
125 + * __split_huge_page_refcount() cannot run
126 + * from under us.
127 + */
128 + VM_BUG_ON(page_mapcount(page) < 0);
129 + VM_BUG_ON(atomic_read(&page->_count) != 0);
130 + atomic_inc(&page->_mapcount);
131 +}
132 +
133 extern bool __get_page_tail(struct page *page);
134
135 static inline void get_page(struct page *page)