From d82fa87d2b60e8affea3b244ad23c5d9a59c584a Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 18 Dec 2014 16:17:29 -0800 Subject: mm/memory.c:do_shared_fault(): add comment Belatedly document the changes in commit f0c6d4d295e4 ("mm: introduce do_shared_fault() and drop do_fault()"). 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 Signed-off-by: Linus Torvalds --- mm/memory.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mm') diff --git a/mm/memory.c b/mm/memory.c index 6efe36a998ba..d8aebc52265f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2996,6 +2996,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) { -- cgit v1.2.3-59-g8ed1b