linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: akpm@linux-foundation.org, sfr@canb.auug.org.au,
	error27@gmail.com, willy@infradead.org, david@redhat.com,
	jgg@ziepe.ca, yuzhao@google.com, dhowells@redhat.com,
	hughd@google.com, mathieu.desnoyers@efficios.com,
	pasha.tatashin@soleen.com, laurent.dufour@fr.ibm.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/2] mm/mmap: remove unnecessary vp->vma check in vma_prepare
Date: Wed, 1 Mar 2023 09:10:03 -0500	[thread overview]
Message-ID: <20230301141003.xh47kjle2lcezn55@revolver> (raw)
In-Reply-To: <20230301022720.1380780-1-surenb@google.com>

* Suren Baghdasaryan <surenb@google.com> [230228 21:27]:
> vp->vma in vma_prepare() is always non-NULL, therefore checking it is
> not necessary. Remove the extra check.
> 
> Fixes: e8f071350ea5 ("mm/mmap: write-lock VMAs in vma_prepare before modifying them")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://lore.kernel.org/r/202302281802.J93Nma7q-lkp@intel.com/
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> ---
> Fix cleanly apply over mm-unstable, SHA in "Fixes" is from that tree.
> 
>  mm/mmap.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 0cd3714c2182..0759d53b470c 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -505,8 +505,7 @@ static inline void init_vma_prep(struct vma_prepare *vp,
>   */
>  static inline void vma_prepare(struct vma_prepare *vp)
>  {
> -	if (vp->vma)
> -		vma_start_write(vp->vma);
> +	vma_start_write(vp->vma);

Would a WARN_ON_ONCE() be worth it?  Maybe not since it will be detected
rather quickly once we dereference it below, but it might make it more
clear as to what happened?

I'm happy either way.

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

>  	if (vp->adj_next)
>  		vma_start_write(vp->adj_next);
>  	/* vp->insert is always a newly created VMA, no need for locking */
> -- 
> 2.39.2.722.g9855ee24e9-goog
> 


  parent reply	other threads:[~2023-03-01 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  2:27 Suren Baghdasaryan
2023-03-01  2:27 ` [PATCH 2/2] mm: document FAULT_FLAG_VMA_LOCK flag Suren Baghdasaryan
2023-03-01  8:27   ` David Hildenbrand
2023-03-01 17:57     ` Suren Baghdasaryan
2023-03-01  8:26 ` [PATCH 1/2] mm/mmap: remove unnecessary vp->vma check in vma_prepare David Hildenbrand
2023-03-01 14:10 ` Liam R. Howlett [this message]
2023-03-01 17:54   ` Suren Baghdasaryan

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=20230301141003.xh47kjle2lcezn55@revolver \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=error27@gmail.com \
    --cc=hughd@google.com \
    --cc=jgg@ziepe.ca \
    --cc=laurent.dufour@fr.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=sfr@canb.auug.org.au \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    --cc=yuzhao@google.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