From: Andrew Morton Date: Thu, 22 May 2014 00:42:44 +0000 (+1000) Subject: mm-introduce-do_shared_fault-and-drop-do_fault-fix-fix X-Git-Tag: next-20140530~2^2~381 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c1ba2f3398430c557876148197eaf5e1ce240c6b;p=karo-tx-linux.git mm-introduce-do_shared_fault-and-drop-do_fault-fix-fix add comment which may not be true :( Cc: Andi Kleen Cc: Bob Liu Cc: Dave Hansen Cc: Kirill A. Shutemov Cc: Matthew Wilcox Cc: Mel Gorman Cc: Naoya Horiguchi Cc: Rik van Riel Cc: Sasha Levin Signed-off-by: Andrew Morton --- diff --git a/mm/memory.c b/mm/memory.c index 574448ea0248..41a8d59d9fd1 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3625,6 +3625,12 @@ static int do_shared_fault(struct mm_struct *mm, struct vm_area_struct *vma, if (set_page_dirty(fault_page)) dirtied = 1; + /* + * Take a local copy of the address_space - page.mapping may be zeroed + * by truncate after unlock_page(). The address_space itself remains + * pinned by vma->vm_file's reference. We rely on unlock_page()'s + * release semantics to prevent the compiler from undoing this copying. + */ mapping = fault_page->mapping; unlock_page(fault_page); if ((dirtied || vma->vm_ops->page_mkwrite) && mapping) {