projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8024ee2
)
khugepaged: recheck pmd after mmap_sem re-acquired
author
Kirill A. Shutemov
<kirill.shutemov@linux.intel.com>
Tue, 26 Jul 2016 22:25:12 +0000
(15:25 -0700)
committer
Linus Torvalds
<torvalds@linux-foundation.org>
Tue, 26 Jul 2016 23:19:19 +0000
(16:19 -0700)
Vlastimil noted[1] that pmd can be no longer valid after we drop
mmap_sem. We need recheck it once mmap_sem taken again.
[1] http://lkml.kernel.org/r/
12918dcd
-a695-c6f4-e06f-
69141c5f357f
@suse.cz
Link:
http://lkml.kernel.org/r/1466021202-61880-6-git-send-email-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/huge_memory.c
patch
|
blob
|
history
diff --git
a/mm/huge_memory.c
b/mm/huge_memory.c
index 1841e0ceac235108ec40d3a24a4600102b230024..1a90f55d930fd5c9f25a7a200c27129732e7e96f 100644
(file)
--- a/
mm/huge_memory.c
+++ b/
mm/huge_memory.c
@@
-2433,6
+2433,9
@@
static bool __collapse_huge_page_swapin(struct mm_struct *mm,
/* vma is no longer available, don't continue to swapin */
if (hugepage_vma_revalidate(mm, address))
return false;
+ /* check if the pmd is still valid */
+ if (mm_find_pmd(mm, address) != pmd)
+ return false;
}
if (ret & VM_FAULT_ERROR) {
trace_mm_collapse_huge_page_swapin(mm, swapped_in, 0);
@@
-2518,6
+2521,9
@@
static void collapse_huge_page(struct mm_struct *mm,
result = hugepage_vma_revalidate(mm, address);
if (result)
goto out;
+ /* check if the pmd is still valid */
+ if (mm_find_pmd(mm, address) != pmd)
+ goto out;
anon_vma_lock_write(vma->anon_vma);