diff options
author | Hugh Dickins <hugh@veritas.com> | 2008-03-04 17:29:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-03-04 19:35:14 -0500 |
commit | 61469f1d51777fc3b6d8d70da8373ee77ee13349 (patch) | |
tree | cdcde89af7b998c340414f305a2a723106770c17 /mm/memory.c | |
parent | 6dbf6d3bb955d5a92005b6ecd6ffad2c5b95b963 (diff) |
memcg: when do_swap's do_wp_page fails
Don't uncharge when do_swap_page's call to do_wp_page fails: the page which
was charged for is there in the pagetable, and will be correctly uncharged
when that area is unmapped - it was only its COWing which failed.
And while we're here, remove earlier XXX comment: yes, OR in do_wp_page's
return value (maybe VM_FAULT_WRITE) with do_swap_page's there; but if it
fails, mask out success bits, which might confuse some arches e.g. sparc.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: David Rientjes <rientjes@google.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hirokazu Takahashi <taka@valinux.co.jp>
Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c index 7f8c03ec587c..0d14d1e58a5f 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2093,12 +2093,9 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2093 | unlock_page(page); | 2093 | unlock_page(page); |
2094 | 2094 | ||
2095 | if (write_access) { | 2095 | if (write_access) { |
2096 | /* XXX: We could OR the do_wp_page code with this one? */ | 2096 | ret |= do_wp_page(mm, vma, address, page_table, pmd, ptl, pte); |
2097 | if (do_wp_page(mm, vma, address, | 2097 | if (ret & VM_FAULT_ERROR) |
2098 | page_table, pmd, ptl, pte) & VM_FAULT_OOM) { | 2098 | ret &= VM_FAULT_ERROR; |
2099 | mem_cgroup_uncharge_page(page); | ||
2100 | ret = VM_FAULT_OOM; | ||
2101 | } | ||
2102 | goto out; | 2099 | goto out; |
2103 | } | 2100 | } |
2104 | 2101 | ||