Re: [PATCH] mm: cleanup: remove unused tsk arg from __access_remote_vm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 26, 2020 at 12:41:37AM -0700, John Hubbard wrote:
> 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.
> 
> Delete both the comment, and the argument.

I'd also mention that making page fault accounting actually use this
task struct is quite a project, so there is no point to keep tsk
argument.

> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
> Cc: Oleg Nesterov <oleg@xxxxxxxxxx>

FWIW:

Reviewed-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>

> ---
> 
> Hi,
> 
> Just something that caught my eye when I was reviewing a semi-related
> patchset.
> 
> thanks,
> John Hubbard
> NVIDIA
> 
>  include/linux/mm.h |  4 ++--
>  kernel/ptrace.c    |  2 +-
>  mm/memory.c        | 11 +++++------
>  mm/nommu.c         |  8 ++++----
>  4 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index ef360fe70aaf..b3b85a5c5937 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -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,
> diff --git a/kernel/ptrace.c b/kernel/ptrace.c
> index 43d6179508d6..fbbe32443b18 100644
> --- a/kernel/ptrace.c
> +++ b/kernel/ptrace.c
> @@ -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;
> diff --git a/mm/memory.c b/mm/memory.c
> index c48f8df6e502..25b28bc251d5 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4874,11 +4874,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;
> @@ -4955,7 +4954,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);
>  }
>  
>  /*
> @@ -4973,7 +4972,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);
>  
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 0faf39b32cdb..870fea12823e 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -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;
> @@ -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);
>  }
>  
>  /*
> @@ -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;
> 
> base-commit: 3650b228f83adda7e5ee532e2b90429c03f7b9ec
> -- 
> 2.29.0
> 
> 

-- 
Sincerely yours,
Mike.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux