Commit 419d8c96dbfa558f00e623023917d0a5afc46129

Authored by Michel Lespinasse
Committed by Linus Torvalds
1 parent e15f8c01af

mlock: do not munlock pages in __do_fault()

If the page is going to be written to, __do_page needs to break COW.

However, the old page (before breaking COW) was never mapped mapped into
the current pte (__do_fault is only called when the pte is not present),
so vmscan can't have marked the old page as PageMlocked due to being
mapped in __do_fault's VMA.  Therefore, __do_fault() does not need to
worry about clearing PageMlocked() on the old page.

Signed-off-by: Michel Lespinasse <walken@google.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 0 additions and 6 deletions Side-by-side Diff

... ... @@ -3051,12 +3051,6 @@
3051 3051 goto out;
3052 3052 }
3053 3053 charged = 1;
3054   - /*
3055   - * Don't let another task, with possibly unlocked vma,
3056   - * keep the mlocked page.
3057   - */
3058   - if (vma->vm_flags & VM_LOCKED)
3059   - clear_page_mlock(vmf.page);
3060 3054 copy_user_highpage(page, vmf.page, address, vma);
3061 3055 __SetPageUptodate(page);
3062 3056 } else {