From a8afba692f742ac8d7bf4ca56b54d0844c7e51ec Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Thu, 10 Feb 2011 15:01:32 -0800 Subject: [PATCH] --- yaml --- r: 233143 b: refs/heads/master c: e15f8c01af924e611bc7be1e45449c4a74e5dfdd h: refs/heads/master i: 233141: 25eb376c5f028779bc6bbfa8ef1c448a068d88bf 233139: ba7a381a3c7ce7c639a62ef037664d897b0c6ddf 233135: 5cae0d93fe318d4da215e711c06628e75cac4af7 v: v3 --- [refs] | 2 +- trunk/mm/memory.c | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index fbd8154e7202..e3f937ccd1eb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e6d2e2b2b1e1455df16d68a78f4a3874c7b3ad20 +refs/heads/master: e15f8c01af924e611bc7be1e45449c4a74e5dfdd diff --git a/trunk/mm/memory.c b/trunk/mm/memory.c index 31250faff390..32df03cf13a5 100644 --- a/trunk/mm/memory.c +++ b/trunk/mm/memory.c @@ -2219,7 +2219,6 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, &ptl); if (!pte_same(*page_table, orig_pte)) { unlock_page(old_page); - page_cache_release(old_page); goto unlock; } page_cache_release(old_page); @@ -2289,7 +2288,6 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, &ptl); if (!pte_same(*page_table, orig_pte)) { unlock_page(old_page); - page_cache_release(old_page); goto unlock; } @@ -2367,16 +2365,6 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, } __SetPageUptodate(new_page); - /* - * Don't let another task, with possibly unlocked vma, - * keep the mlocked page. - */ - if ((vma->vm_flags & VM_LOCKED) && old_page) { - lock_page(old_page); /* for LRU manipulation */ - clear_page_mlock(old_page); - unlock_page(old_page); - } - if (mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL)) goto oom_free_new; @@ -2444,10 +2432,20 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, if (new_page) page_cache_release(new_page); - if (old_page) - page_cache_release(old_page); unlock: pte_unmap_unlock(page_table, ptl); + if (old_page) { + /* + * Don't let another task, with possibly unlocked vma, + * keep the mlocked page. + */ + if ((ret & VM_FAULT_WRITE) && (vma->vm_flags & VM_LOCKED)) { + lock_page(old_page); /* LRU manipulation */ + munlock_vma_page(old_page); + unlock_page(old_page); + } + page_cache_release(old_page); + } return ret; oom_free_new: page_cache_release(new_page);