All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Andrea Arcangeli <aarcange@redhat.com>, peterz@infradead.org
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	willy@infradead.org,  riel@surriel.com, mhocko@suse.com,
	ying huang <ying.huang@intel.com>,
	 jrdr linux <jrdr.linux@gmail.com>,
	jglisse@redhat.com,  aneesh kumar <aneesh.kumar@linux.ibm.com>,
	david@redhat.com,  raquini@redhat.com, rientjes@google.com,
	kirill@shutemov.name,  mgorman@techsingularity.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/memory.c: do_fault: avoid usage of stale vm_area_struct
Date: Sun, 3 Mar 2019 02:27:02 -0500 (EST)	[thread overview]
Message-ID: <701776300.4537344.1551598022408.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20190302185144.GD31083@redhat.com>



----- Original Message -----
> Hello Jan,
> 
> On Sat, Mar 02, 2019 at 07:19:39PM +0100, Jan Stancek wrote:
> > +	struct mm_struct *vm_mm = READ_ONCE(vma->vm_mm);
> 
> The vma->vm_mm cannot change under gcc there, so no need of
> READ_ONCE. The release of mmap_sem has release semantics so the
> vma->vm_mm access cannot be reordered after up_read(mmap_sem) either.
> 
> Other than the above detail:
> 
> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>

Thank you for review, I dropped READ_ONCE and sent v3 with your
Reviewed-by included. I also successfully re-ran tests over-night.

> Would this not need a corresponding WRITE_ONCE() in vma_init() ?

There's at least 2 context switches between, so I think it wouldn't matter.
My concern was gcc optimizing out vm_mm, and vma->vm_mm access happening only
after do_read_fault().


  reply	other threads:[~2019-03-03  7:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 15:11 [PATCH] mm/memory.c: do_fault: avoid usage of stale vm_area_struct Jan Stancek
2019-03-02 17:10 ` Matthew Wilcox
2019-03-02 18:00   ` Jan Stancek
2019-03-02 18:19   ` [PATCH v2] " Jan Stancek
2019-03-02 18:45     ` Peter Zijlstra
2019-03-02 18:51     ` Andrea Arcangeli
2019-03-03  7:27       ` Jan Stancek [this message]
2019-03-03  7:28       ` [PATCH v3] " Jan Stancek
2019-03-03 10:36         ` Matthew Wilcox
2019-03-04  0:13         ` Rafael Aquini
2019-03-04  8:10         ` Minchan Kim
2019-03-04  8:19         ` Kirill A. Shutemov

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=701776300.4537344.1551598022408.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=jglisse@redhat.com \
    --cc=jrdr.linux@gmail.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=peterz@infradead.org \
    --cc=raquini@redhat.com \
    --cc=riel@surriel.com \
    --cc=rientjes@google.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.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 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.