aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh.dickins@tiscali.co.uk>2009-09-21 20:02:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:33 -0400
commit7103ad323b1ae32bedc3267402117e2f8b45e48d (patch)
treed4255fceb827cc0a70b5a748182766d22934dc78
parent35451beecbd7c86ce3249d543594517a5fe9a0cd (diff)
ksm: mremap use err from ksm_madvise
mremap move's use of ksm_madvise() was assuming -ENOMEM on failure, because ksm_madvise used to say -EAGAIN for that; but ksm_madvise now says -ENOMEM (letting madvise convert that to -EAGAIN), and can also say -ERESTARTSYS when signalled: so pass the error from ksm_madvise. Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Acked-by: Izik Eidus <ieidus@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>
-rw-r--r--mm/mremap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index 93adddecf978..20a07dba6be0 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -175,6 +175,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
175 unsigned long excess = 0; 175 unsigned long excess = 0;
176 unsigned long hiwater_vm; 176 unsigned long hiwater_vm;
177 int split = 0; 177 int split = 0;
178 int err;
178 179
179 /* 180 /*
180 * We'd prefer to avoid failure later on in do_munmap: 181 * We'd prefer to avoid failure later on in do_munmap:
@@ -190,9 +191,10 @@ static unsigned long move_vma(struct vm_area_struct *vma,
190 * pages recently unmapped. But leave vma->vm_flags as it was, 191 * pages recently unmapped. But leave vma->vm_flags as it was,
191 * so KSM can come around to merge on vma and new_vma afterwards. 192 * so KSM can come around to merge on vma and new_vma afterwards.
192 */ 193 */
193 if (ksm_madvise(vma, old_addr, old_addr + old_len, 194 err = ksm_madvise(vma, old_addr, old_addr + old_len,
194 MADV_UNMERGEABLE, &vm_flags)) 195 MADV_UNMERGEABLE, &vm_flags);
195 return -ENOMEM; 196 if (err)
197 return err;
196 198
197 new_pgoff = vma->vm_pgoff + ((old_addr - vma->vm_start) >> PAGE_SHIFT); 199 new_pgoff = vma->vm_pgoff + ((old_addr - vma->vm_start) >> PAGE_SHIFT);
198 new_vma = copy_vma(&vma, new_addr, new_len, new_pgoff); 200 new_vma = copy_vma(&vma, new_addr, new_len, new_pgoff);