summaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-04-04 04:24:58 -0400
committerIngo Molnar <mingo@kernel.org>2016-04-07 04:46:14 -0400
commitc12d2da56d0e07d230968ee2305aaa86b93a6832 (patch)
tree18305357f1190cd1fc750e1d093fe610429e7628 /mm/nommu.c
parent9735a22799b9214d17d3c231fe377fc852f042e9 (diff)
mm/gup: Remove the macro overload API migration helpers from the get_user*() APIs
The pkeys changes brought about a truly hideous set of macros in: cde70140fed8 ("mm/gup: Overload get_user_pages() functions") ... which macros are (ab-)using the fact that __VA_ARGS__ can be used to shift parameter positions in macro arguments without breaking the build and so can be used to call separate C functions depending on the number of arguments of the macro. This allowed easy migration of these 3 GUP APIs, as both these variants worked at the C level: old: ret = get_user_pages(current, current->mm, address, 1, 1, 0, &page, NULL); new: ret = get_user_pages(address, 1, 1, 0, &page, NULL); ... while we also generated a (functionally harmless but noticeable) build time warning if the old API was used. As there are over 300 uses of these APIs, this trick eased the migration of the API and avoided excessive migration pain in linux-next. Now, with its work done, get rid of all of that complication and ugliness: 3 files changed, 16 insertions(+), 140 deletions(-) ... where the linecount of the migration hack was further inflated by the fact that there are NOMMU variants of these GUP APIs as well. Much of the conversion was done in linux-next over the past couple of months, and Linus recently removed all remaining old API uses from the upstream tree in the following upstrea commit: cb107161df3c ("Convert straggling drivers to new six-argument get_user_pages()") There was one more old-API usage in mm/gup.c, in the CONFIG_HAVE_GENERIC_RCU_GUP code path that ARM, ARM64 and PowerPC uses. After this commit any old API usage will break the build. [ Also fixed a PowerPC/HAVE_GENERIC_RCU_GUP warning reported by Stephen Rothwell. ] Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Dave Hansen <dave@sr71.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'mm/nommu.c')
-rw-r--r--mm/nommu.c44
1 files changed, 7 insertions, 37 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index de8b6b6580c1..bf94913dbbb6 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -15,8 +15,6 @@
15 15
16#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 16#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 17
18#define __DISABLE_GUP_DEPRECATED
19
20#include <linux/export.h> 18#include <linux/export.h>
21#include <linux/mm.h> 19#include <linux/mm.h>
22#include <linux/vmacache.h> 20#include <linux/vmacache.h>
@@ -161,7 +159,7 @@ finish_or_fault:
161 * slab page or a secondary page from a compound page 159 * slab page or a secondary page from a compound page
162 * - don't permit access to VMAs that don't support it, such as I/O mappings 160 * - don't permit access to VMAs that don't support it, such as I/O mappings
163 */ 161 */
164long get_user_pages6(unsigned long start, unsigned long nr_pages, 162long get_user_pages(unsigned long start, unsigned long nr_pages,
165 int write, int force, struct page **pages, 163 int write, int force, struct page **pages,
166 struct vm_area_struct **vmas) 164 struct vm_area_struct **vmas)
167{ 165{
@@ -175,15 +173,15 @@ long get_user_pages6(unsigned long start, unsigned long nr_pages,
175 return __get_user_pages(current, current->mm, start, nr_pages, flags, 173 return __get_user_pages(current, current->mm, start, nr_pages, flags,
176 pages, vmas, NULL); 174 pages, vmas, NULL);
177} 175}
178EXPORT_SYMBOL(get_user_pages6); 176EXPORT_SYMBOL(get_user_pages);
179 177
180long get_user_pages_locked6(unsigned long start, unsigned long nr_pages, 178long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
181 int write, int force, struct page **pages, 179 int write, int force, struct page **pages,
182 int *locked) 180 int *locked)
183{ 181{
184 return get_user_pages6(start, nr_pages, write, force, pages, NULL); 182 return get_user_pages(start, nr_pages, write, force, pages, NULL);
185} 183}
186EXPORT_SYMBOL(get_user_pages_locked6); 184EXPORT_SYMBOL(get_user_pages_locked);
187 185
188long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm, 186long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
189 unsigned long start, unsigned long nr_pages, 187 unsigned long start, unsigned long nr_pages,
@@ -199,13 +197,13 @@ long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
199} 197}
200EXPORT_SYMBOL(__get_user_pages_unlocked); 198EXPORT_SYMBOL(__get_user_pages_unlocked);
201 199
202long get_user_pages_unlocked5(unsigned long start, unsigned long nr_pages, 200long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
203 int write, int force, struct page **pages) 201 int write, int force, struct page **pages)
204{ 202{
205 return __get_user_pages_unlocked(current, current->mm, start, nr_pages, 203 return __get_user_pages_unlocked(current, current->mm, start, nr_pages,
206 write, force, pages, 0); 204 write, force, pages, 0);
207} 205}
208EXPORT_SYMBOL(get_user_pages_unlocked5); 206EXPORT_SYMBOL(get_user_pages_unlocked);
209 207
210/** 208/**
211 * follow_pfn - look up PFN at a user virtual address 209 * follow_pfn - look up PFN at a user virtual address
@@ -1989,31 +1987,3 @@ static int __meminit init_admin_reserve(void)
1989 return 0; 1987 return 0;
1990} 1988}
1991subsys_initcall(init_admin_reserve); 1989subsys_initcall(init_admin_reserve);
1992
1993long get_user_pages8(struct task_struct *tsk, struct mm_struct *mm,
1994 unsigned long start, unsigned long nr_pages,
1995 int write, int force, struct page **pages,
1996 struct vm_area_struct **vmas)
1997{
1998 return get_user_pages6(start, nr_pages, write, force, pages, vmas);
1999}
2000EXPORT_SYMBOL(get_user_pages8);
2001
2002long get_user_pages_locked8(struct task_struct *tsk, struct mm_struct *mm,
2003 unsigned long start, unsigned long nr_pages,
2004 int write, int force, struct page **pages,
2005 int *locked)
2006{
2007 return get_user_pages_locked6(start, nr_pages, write,
2008 force, pages, locked);
2009}
2010EXPORT_SYMBOL(get_user_pages_locked8);
2011
2012long get_user_pages_unlocked7(struct task_struct *tsk, struct mm_struct *mm,
2013 unsigned long start, unsigned long nr_pages,
2014 int write, int force, struct page **pages)
2015{
2016 return get_user_pages_unlocked5(start, nr_pages, write, force, pages);
2017}
2018EXPORT_SYMBOL(get_user_pages_unlocked7);
2019