[PATCH] mm: avoid do_fault_around() on non-linear mappings
From: Kirill A. Shutemov
Date: Tue Jul 15 2014 - 07:40:02 EST
Originally, I've wrongly assumed that non-linear mapping are always
populated at least with pte_file() entries there, so !pte_none() check
will catch them. It's not always the case: we can get there from
__mm_populte in remap_file_pages() and pte will be clear.
Let's put explicit check for non-linear mapping.
This is a root cause of recent "kernel BUG at mm/filemap.c:202!".
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx # 3.15+
---
mm/memory.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/memory.c b/mm/memory.c
index d67fd9fcf1f2..440ad48266d6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2882,7 +2882,8 @@ static int do_read_fault(struct mm_struct *mm, struct vm_area_struct *vma,
* if page by the offset is not ready to be mapped (cold cache or
* something).
*/
- if (vma->vm_ops->map_pages && fault_around_pages() > 1) {
+ if (vma->vm_ops->map_pages && fault_around_pages() > 1 &&
+ !(vma->vm_flags & VM_NONLINEAR)) {
pte = pte_offset_map_lock(mm, pmd, address, &ptl);
do_fault_around(vma, address, pte, pgoff, flags);
if (!pte_same(*pte, orig_pte))
--
2.0.1
--
Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/