Skip to content

Commit c803c9c

Browse files
author
Al Viro
committed
fold __get_user_pages_unlocked() into its sole remaining caller
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 4fbd8d1 commit c803c9c

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

mm/gup.c

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -964,30 +964,6 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
964964
}
965965
EXPORT_SYMBOL(get_user_pages_locked);
966966

967-
/*
968-
* Same as get_user_pages_unlocked(...., FOLL_TOUCH) but it allows for
969-
* tsk, mm to be specified.
970-
*
971-
* NOTE: here FOLL_TOUCH is not set implicitly and must be set by the
972-
* caller if required (just like with __get_user_pages). "FOLL_GET"
973-
* is set implicitly if "pages" is non-NULL.
974-
*/
975-
static __always_inline long __get_user_pages_unlocked(struct task_struct *tsk,
976-
struct mm_struct *mm, unsigned long start,
977-
unsigned long nr_pages, struct page **pages,
978-
unsigned int gup_flags)
979-
{
980-
long ret;
981-
int locked = 1;
982-
983-
down_read(&mm->mmap_sem);
984-
ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
985-
&locked, false, gup_flags);
986-
if (locked)
987-
up_read(&mm->mmap_sem);
988-
return ret;
989-
}
990-
991967
/*
992968
* get_user_pages_unlocked() is suitable to replace the form:
993969
*
@@ -1006,8 +982,16 @@ static __always_inline long __get_user_pages_unlocked(struct task_struct *tsk,
1006982
long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
1007983
struct page **pages, unsigned int gup_flags)
1008984
{
1009-
return __get_user_pages_unlocked(current, current->mm, start, nr_pages,
1010-
pages, gup_flags | FOLL_TOUCH);
985+
struct mm_struct *mm = current->mm;
986+
int locked = 1;
987+
long ret;
988+
989+
down_read(&mm->mmap_sem);
990+
ret = __get_user_pages_locked(current, mm, start, nr_pages, pages, NULL,
991+
&locked, false, gup_flags | FOLL_TOUCH);
992+
if (locked)
993+
up_read(&mm->mmap_sem);
994+
return ret;
1011995
}
1012996
EXPORT_SYMBOL(get_user_pages_unlocked);
1013997

0 commit comments

Comments
 (0)