Skip to content

Commit

Permalink
fold __get_user_pages_unlocked() into its sole remaining caller
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Dec 3, 2017
1 parent 4fbd8d1 commit c803c9c
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions mm/gup.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,30 +964,6 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
}
EXPORT_SYMBOL(get_user_pages_locked);

/*
* Same as get_user_pages_unlocked(...., FOLL_TOUCH) but it allows for
* tsk, mm to be specified.
*
* NOTE: here FOLL_TOUCH is not set implicitly and must be set by the
* caller if required (just like with __get_user_pages). "FOLL_GET"
* is set implicitly if "pages" is non-NULL.
*/
static __always_inline long __get_user_pages_unlocked(struct task_struct *tsk,
struct mm_struct *mm, unsigned long start,
unsigned long nr_pages, struct page **pages,
unsigned int gup_flags)
{
long ret;
int locked = 1;

down_read(&mm->mmap_sem);
ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
&locked, false, gup_flags);
if (locked)
up_read(&mm->mmap_sem);
return ret;
}

/*
* get_user_pages_unlocked() is suitable to replace the form:
*
Expand All @@ -1006,8 +982,16 @@ static __always_inline long __get_user_pages_unlocked(struct task_struct *tsk,
long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
struct page **pages, unsigned int gup_flags)
{
return __get_user_pages_unlocked(current, current->mm, start, nr_pages,
pages, gup_flags | FOLL_TOUCH);
struct mm_struct *mm = current->mm;
int locked = 1;
long ret;

down_read(&mm->mmap_sem);
ret = __get_user_pages_locked(current, mm, start, nr_pages, pages, NULL,
&locked, false, gup_flags | FOLL_TOUCH);
if (locked)
up_read(&mm->mmap_sem);
return ret;
}
EXPORT_SYMBOL(get_user_pages_unlocked);

Expand Down

0 comments on commit c803c9c

Please sign in to comment.