Skip to content

Commit

Permalink
mm: cleanup: remove unused tsk arg from __access_remote_vm
Browse files Browse the repository at this point in the history
Despite a comment that said that page fault accounting would be charged to
whatever task_struct* was passed into __access_remote_vm(), the tsk
argument was actually unused.

Making page fault accounting actually use this task struct is quite a
project, so there is no point in keeping the tsk argument.

Delete both the comment, and the argument.

[rppt@linux.ibm.com: changelog addition]

Link: https://lkml.kernel.org/r/20201026074137.4147787-1-jhubbard@nvidia.com
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
John Hubbard authored and Linus Torvalds committed Dec 15, 2020
1 parent be37c98 commit d3f5ffc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1716,8 +1716,8 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr,
void *buf, int len, unsigned int gup_flags);
extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
void *buf, int len, unsigned int gup_flags);
extern int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
unsigned long addr, void *buf, int len, unsigned int gup_flags);
extern int __access_remote_vm(struct mm_struct *mm, unsigned long addr,
void *buf, int len, unsigned int gup_flags);

long get_user_pages_remote(struct mm_struct *mm,
unsigned long start, unsigned long nr_pages,
Expand Down
2 changes: 1 addition & 1 deletion kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,
return 0;
}

ret = __access_remote_vm(tsk, mm, addr, buf, len, gup_flags);
ret = __access_remote_vm(mm, addr, buf, len, gup_flags);
mmput(mm);

return ret;
Expand Down
11 changes: 5 additions & 6 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -4885,11 +4885,10 @@ EXPORT_SYMBOL_GPL(generic_access_phys);
#endif

/*
* Access another process' address space as given in mm. If non-NULL, use the
* given task for page fault accounting.
* Access another process' address space as given in mm.
*/
int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
unsigned long addr, void *buf, int len, unsigned int gup_flags)
int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf,
int len, unsigned int gup_flags)
{
struct vm_area_struct *vma;
void *old_buf = buf;
Expand Down Expand Up @@ -4966,7 +4965,7 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
int access_remote_vm(struct mm_struct *mm, unsigned long addr,
void *buf, int len, unsigned int gup_flags)
{
return __access_remote_vm(NULL, mm, addr, buf, len, gup_flags);
return __access_remote_vm(mm, addr, buf, len, gup_flags);
}

/*
Expand All @@ -4984,7 +4983,7 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr,
if (!mm)
return 0;

ret = __access_remote_vm(tsk, mm, addr, buf, len, gup_flags);
ret = __access_remote_vm(mm, addr, buf, len, gup_flags);

mmput(mm);

Expand Down
8 changes: 4 additions & 4 deletions mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,8 @@ void filemap_map_pages(struct vm_fault *vmf,
}
EXPORT_SYMBOL(filemap_map_pages);

int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
unsigned long addr, void *buf, int len, unsigned int gup_flags)
int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf,
int len, unsigned int gup_flags)
{
struct vm_area_struct *vma;
int write = gup_flags & FOLL_WRITE;
Expand Down Expand Up @@ -1722,7 +1722,7 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
int access_remote_vm(struct mm_struct *mm, unsigned long addr,
void *buf, int len, unsigned int gup_flags)
{
return __access_remote_vm(NULL, mm, addr, buf, len, gup_flags);
return __access_remote_vm(mm, addr, buf, len, gup_flags);
}

/*
Expand All @@ -1741,7 +1741,7 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
if (!mm)
return 0;

len = __access_remote_vm(tsk, mm, addr, buf, len, gup_flags);
len = __access_remote_vm(mm, addr, buf, len, gup_flags);

mmput(mm);
return len;
Expand Down

0 comments on commit d3f5ffc

Please sign in to comment.