Commit 912985dce45ef18fcdd9f5439fef054e0e22302a
1 parent
40c42076eb
Exists in
master
and in
4 other branches
mm: Make generic weak get_user_pages_fast and EXPORT_GPL it
Out of line get_user_pages_fast fallback implementation, make it a weak symbol, get rid of CONFIG_HAVE_GET_USER_PAGES_FAST. Export the symbol to modules so lguest can use it. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Showing 6 changed files with 16 additions and 29 deletions Side-by-side Diff
arch/powerpc/Kconfig
arch/x86/Kconfig
arch/x86/mm/Makefile
include/linux/mm.h
... | ... | @@ -834,7 +834,6 @@ |
834 | 834 | struct vm_area_struct **pprev, unsigned long start, |
835 | 835 | unsigned long end, unsigned long newflags); |
836 | 836 | |
837 | -#ifdef CONFIG_HAVE_GET_USER_PAGES_FAST | |
838 | 837 | /* |
839 | 838 | * get_user_pages_fast provides equivalent functionality to get_user_pages, |
840 | 839 | * operating on current and current->mm (force=0 and doesn't return any vmas). |
... | ... | @@ -847,25 +846,6 @@ |
847 | 846 | */ |
848 | 847 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
849 | 848 | struct page **pages); |
850 | - | |
851 | -#else | |
852 | -/* | |
853 | - * Should probably be moved to asm-generic, and architectures can include it if | |
854 | - * they don't implement their own get_user_pages_fast. | |
855 | - */ | |
856 | -#define get_user_pages_fast(start, nr_pages, write, pages) \ | |
857 | -({ \ | |
858 | - struct mm_struct *mm = current->mm; \ | |
859 | - int ret; \ | |
860 | - \ | |
861 | - down_read(&mm->mmap_sem); \ | |
862 | - ret = get_user_pages(current, mm, start, nr_pages, \ | |
863 | - write, 0, pages, NULL); \ | |
864 | - up_read(&mm->mmap_sem); \ | |
865 | - \ | |
866 | - ret; \ | |
867 | -}) | |
868 | -#endif | |
869 | 849 | |
870 | 850 | /* |
871 | 851 | * A callback you can register to apply pressure to ageable caches. |
mm/Kconfig
mm/util.c
... | ... | @@ -171,4 +171,19 @@ |
171 | 171 | mm->unmap_area = arch_unmap_area; |
172 | 172 | } |
173 | 173 | #endif |
174 | + | |
175 | +int __attribute__((weak)) get_user_pages_fast(unsigned long start, | |
176 | + int nr_pages, int write, struct page **pages) | |
177 | +{ | |
178 | + struct mm_struct *mm = current->mm; | |
179 | + int ret; | |
180 | + | |
181 | + down_read(&mm->mmap_sem); | |
182 | + ret = get_user_pages(current, mm, start, nr_pages, | |
183 | + write, 0, pages, NULL); | |
184 | + up_read(&mm->mmap_sem); | |
185 | + | |
186 | + return ret; | |
187 | +} | |
188 | +EXPORT_SYMBOL_GPL(get_user_pages_fast); |