aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins2014-08-28 13:35:35 -0500
committerJiri Slaby2014-09-26 04:52:06 -0500
commit1d08848674752a433634f5c144500447de8ab727 (patch)
tree7d80c34eb10fa1ae74d42179aea75ba3df1ee343
parent335886a3689bb3be6bc37f6601006ee20ccd80a0 (diff)
downloadti-linux-kernel-1d08848674752a433634f5c144500447de8ab727.tar.gz
ti-linux-kernel-1d08848674752a433634f5c144500447de8ab727.tar.xz
ti-linux-kernel-1d08848674752a433634f5c144500447de8ab727.zip
mm/memory.c: use entry = ACCESS_ONCE(*pte) in handle_pte_fault()
commit c0d73261f5c1355a35b8b40e871d31578ce0c044 upstream. Use ACCESS_ONCE() in handle_pte_fault() when getting the entry or orig_pte upon which all subsequent decisions and pte_same() tests will be made. I have no evidence that its lack is responsible for the mm/filemap.c:202 BUG_ON(page_mapped(page)) in __delete_from_page_cache() found by trinity, and I am not optimistic that it will fix it. But I have found no other explanation, and ACCESS_ONCE() here will surely not hurt. If gcc does re-access the pte before passing it down, then that would be disastrous for correct page fault handling, and certainly could explain the page_mapped() BUGs seen (concurrent fault causing page to be mapped in a second time on top of itself: mapcount 2 for a single pte). Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--mm/memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 99fe3aa1035c..b870c9c5c89b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3698,7 +3698,7 @@ static int handle_pte_fault(struct mm_struct *mm,
3698 pte_t entry; 3698 pte_t entry;
3699 spinlock_t *ptl; 3699 spinlock_t *ptl;
3700 3700
3701 entry = *pte; 3701 entry = ACCESS_ONCE(*pte);
3702 if (!pte_present(entry)) { 3702 if (!pte_present(entry)) {
3703 if (pte_none(entry)) { 3703 if (pte_none(entry)) {
3704 if (vma->vm_ops) { 3704 if (vma->vm_ops) {