linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: John Hubbard <jhubbard@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH] mm: cleanup: remove unused tsk arg from __access_remote_vm
Date: Mon, 26 Oct 2020 11:57:45 +0200	[thread overview]
Message-ID: <20201026095745.GE1154158@kernel.org> (raw)
In-Reply-To: <20201026074137.4147787-1-jhubbard@nvidia.com>

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@nvidia.com>
> Cc: Oleg Nesterov <oleg@redhat.com>

FWIW:

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
> 
> 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.


      reply	other threads:[~2020-10-26  9:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26  7:41 [PATCH] mm: cleanup: remove unused tsk arg from __access_remote_vm John Hubbard
2020-10-26  9:57 ` Mike Rapoport [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201026095745.GE1154158@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).