All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org,
	linux-media@vger.kernel.org, chris@chris-wilson.co.uk,
	airlied@redhat.com, akpm@linux-foundation.org, daniel@ffwll.ch,
	sumit.semwal@linaro.org
Subject: Re: [PATCH 1/4] mm: introduce vma_set_file function v2
Date: Thu, 8 Oct 2020 14:49:03 -0700	[thread overview]
Message-ID: <b6b77e60-f93d-efe4-e267-983a2bdbbe71@nvidia.com> (raw)
In-Reply-To: <20201008112342.9394-1-christian.koenig@amd.com>

On 10/8/20 4:23 AM, Christian König wrote:
> Add the new vma_set_file() function to allow changing
> vma->vm_file with the necessary refcount dance.
> 
> v2: add more users of this.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/dma-buf/dma-buf.c                  | 16 +++++-----------
>   drivers/gpu/drm/etnaviv/etnaviv_gem.c      |  4 +---
>   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c |  3 +--
>   drivers/gpu/drm/i915/gem/i915_gem_mman.c   |  4 ++--
>   drivers/gpu/drm/msm/msm_gem.c              |  4 +---
>   drivers/gpu/drm/omapdrm/omap_gem.c         |  3 +--
>   drivers/gpu/drm/vgem/vgem_drv.c            |  3 +--
>   drivers/staging/android/ashmem.c           |  5 ++---
>   include/linux/mm.h                         |  2 ++
>   mm/mmap.c                                  | 16 ++++++++++++++++
>   10 files changed, 32 insertions(+), 28 deletions(-)

Looks like a nice cleanup. Two comments below.

...

> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> index 3d69e51f3e4d..c9d5f1a38af3 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> @@ -893,8 +893,8 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>   	 * requires avoiding extraneous references to their filp, hence why
>   	 * we prefer to use an anonymous file for their mmaps.
>   	 */
> -	fput(vma->vm_file);
> -	vma->vm_file = anon;
> +	vma_set_file(vma, anon);
> +	fput(anon);

That's one fput() too many, isn't it?

...

> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 10b4be1f3e78..a51dc089896e 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -450,9 +450,8 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
>   		vma_set_anonymous(vma);
>   	}
>   
> -	if (vma->vm_file)
> -		fput(vma->vm_file);
> -	vma->vm_file = asma->file;
> +	vma_set_file(vma, asma->file);
> +	fput(asma->file);

Same here: that fput() seems wrong, as it was already done within vma_set_file().


thanks,
-- 
John Hubbard
NVIDIA

WARNING: multiple messages have this Message-ID (diff)
From: John Hubbard <jhubbard@nvidia.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org,
	linux-media@vger.kernel.org, chris@chris-wilson.co.uk,
	airlied@redhat.com, akpm@linux-foundation.org, daniel@ffwll.ch,
	sumit.semwal@linaro.org
Subject: Re: [PATCH 1/4] mm: introduce vma_set_file function v2
Date: Thu, 8 Oct 2020 14:49:03 -0700	[thread overview]
Message-ID: <b6b77e60-f93d-efe4-e267-983a2bdbbe71@nvidia.com> (raw)
In-Reply-To: <20201008112342.9394-1-christian.koenig@amd.com>

On 10/8/20 4:23 AM, Christian König wrote:
> Add the new vma_set_file() function to allow changing
> vma->vm_file with the necessary refcount dance.
> 
> v2: add more users of this.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/dma-buf/dma-buf.c                  | 16 +++++-----------
>   drivers/gpu/drm/etnaviv/etnaviv_gem.c      |  4 +---
>   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c |  3 +--
>   drivers/gpu/drm/i915/gem/i915_gem_mman.c   |  4 ++--
>   drivers/gpu/drm/msm/msm_gem.c              |  4 +---
>   drivers/gpu/drm/omapdrm/omap_gem.c         |  3 +--
>   drivers/gpu/drm/vgem/vgem_drv.c            |  3 +--
>   drivers/staging/android/ashmem.c           |  5 ++---
>   include/linux/mm.h                         |  2 ++
>   mm/mmap.c                                  | 16 ++++++++++++++++
>   10 files changed, 32 insertions(+), 28 deletions(-)

Looks like a nice cleanup. Two comments below.

...

> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> index 3d69e51f3e4d..c9d5f1a38af3 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> @@ -893,8 +893,8 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>   	 * requires avoiding extraneous references to their filp, hence why
>   	 * we prefer to use an anonymous file for their mmaps.
>   	 */
> -	fput(vma->vm_file);
> -	vma->vm_file = anon;
> +	vma_set_file(vma, anon);
> +	fput(anon);

That's one fput() too many, isn't it?

...

> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 10b4be1f3e78..a51dc089896e 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -450,9 +450,8 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
>   		vma_set_anonymous(vma);
>   	}
>   
> -	if (vma->vm_file)
> -		fput(vma->vm_file);
> -	vma->vm_file = asma->file;
> +	vma_set_file(vma, asma->file);
> +	fput(asma->file);

Same here: that fput() seems wrong, as it was already done within vma_set_file().


thanks,
-- 
John Hubbard
NVIDIA
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-10-08 21:49 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 11:23 [PATCH 1/4] mm: introduce vma_set_file function v2 Christian König
2020-10-08 11:23 ` Christian König
2020-10-08 11:23 ` [PATCH 2/4] drm/prime: document that use the page array is deprecated Christian König
2020-10-08 11:23   ` Christian König
2020-10-08 14:09   ` Daniel Vetter
2020-10-08 14:09     ` Daniel Vetter
2020-10-08 14:14     ` Daniel Vetter
2020-10-08 14:14       ` Daniel Vetter
2020-10-09  7:36       ` Christian König
2020-10-09  7:36         ` Christian König
2020-10-09  7:40         ` Daniel Vetter
2020-10-09  7:40           ` Daniel Vetter
2020-10-08 11:23 ` [PATCH 3/4] drm/radeon: stop using pages with drm_prime_sg_to_page_addr_arrays Christian König
2020-10-08 11:23   ` Christian König
2020-10-08 11:23 ` [PATCH 4/4] drm/amdgpu: " Christian König
2020-10-08 11:23   ` Christian König
2020-10-08 11:39 ` [PATCH 1/4] mm: introduce vma_set_file function v2 Matthew Wilcox
2020-10-08 11:39   ` Matthew Wilcox
2020-10-08 12:06   ` Christian König
2020-10-08 12:06     ` Christian König
2020-10-08 14:12 ` Daniel Vetter
2020-10-08 14:12   ` Daniel Vetter
2020-10-09  7:16   ` Christian König
2020-10-09  7:16     ` Christian König
2020-10-09  7:39     ` Daniel Vetter
2020-10-09  7:39       ` Daniel Vetter
2020-10-09 12:12       ` Jason Gunthorpe
2020-10-09 12:12         ` Jason Gunthorpe
2020-10-09 12:15         ` Christian König
2020-10-09 12:15           ` Christian König
2020-10-08 15:35 ` kernel test robot
2020-10-08 15:35   ` kernel test robot
2020-10-08 15:35   ` kernel test robot
2020-10-08 16:19 ` kernel test robot
2020-10-08 16:19   ` kernel test robot
2020-10-08 16:19   ` kernel test robot
2020-10-08 21:49 ` John Hubbard [this message]
2020-10-08 21:49   ` John Hubbard
2020-10-09  7:33   ` Christian König
2020-10-09  7:33     ` Christian König
2020-10-09  7:36     ` John Hubbard
2020-10-09  7:36       ` John Hubbard

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=b6b77e60-f93d-efe4-e267-983a2bdbbe71@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sumit.semwal@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.