Commit 45f83cefe3a5f0476ac3f96382ebfdc3fe4caab2
Committed by
Linus Torvalds
1 parent
623e3db9f9
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
mm: thp: fix up pmd_trans_unstable() locations
pmd_trans_unstable() should be called before pmd_offset_map() in the locations where the mmap_sem is held for reading. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Cc: Larry Woodman <lwoodman@redhat.com> Cc: Ulrich Obergfell <uobergfe@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Mark Salter <msalter@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 6 additions and 3 deletions Side-by-side Diff
fs/proc/task_mmu.c
... | ... | @@ -781,9 +781,6 @@ |
781 | 781 | int err = 0; |
782 | 782 | pagemap_entry_t pme = make_pme(PM_NOT_PRESENT); |
783 | 783 | |
784 | - if (pmd_trans_unstable(pmd)) | |
785 | - return 0; | |
786 | - | |
787 | 784 | /* find the first VMA at or above 'addr' */ |
788 | 785 | vma = find_vma(walk->mm, addr); |
789 | 786 | spin_lock(&walk->mm->page_table_lock); |
... | ... | @@ -802,6 +799,8 @@ |
802 | 799 | return err; |
803 | 800 | } |
804 | 801 | |
802 | + if (pmd_trans_unstable(pmd)) | |
803 | + return 0; | |
805 | 804 | for (; addr != end; addr += PAGE_SIZE) { |
806 | 805 | |
807 | 806 | /* check to see if we've left 'vma' behind |
mm/memcontrol.c
... | ... | @@ -5306,6 +5306,8 @@ |
5306 | 5306 | return 0; |
5307 | 5307 | } |
5308 | 5308 | |
5309 | + if (pmd_trans_unstable(pmd)) | |
5310 | + return 0; | |
5309 | 5311 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
5310 | 5312 | for (; addr != end; pte++, addr += PAGE_SIZE) |
5311 | 5313 | if (get_mctgt_type(vma, addr, *pte, NULL)) |
... | ... | @@ -5502,6 +5504,8 @@ |
5502 | 5504 | return 0; |
5503 | 5505 | } |
5504 | 5506 | |
5507 | + if (pmd_trans_unstable(pmd)) | |
5508 | + return 0; | |
5505 | 5509 | retry: |
5506 | 5510 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
5507 | 5511 | for (; addr != end; addr += PAGE_SIZE) { |