From: Hugh Dickins <hugh.dickins@tiscali.co.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Izik Eidus <ieidus@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 3/3] ksm: mremap use err from ksm_madvise
Date: Sat, 5 Sep 2009 22:26:48 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0909052225250.7387@sister.anvils> (raw)
In-Reply-To: <Pine.LNX.4.64.0909052219580.7381@sister.anvils>
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>
---
mm/mremap.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- mmotm/mm/mremap.c 2009-09-05 14:40:16.000000000 +0100
+++ linux/mm/mremap.c 2009-09-05 16:41:55.000000000 +0100
@@ -175,6 +175,7 @@ static unsigned long move_vma(struct vm_
unsigned long excess = 0;
unsigned long hiwater_vm;
int split = 0;
+ int err;
/*
* We'd prefer to avoid failure later on in do_munmap:
@@ -190,9 +191,10 @@ static unsigned long move_vma(struct vm_
* pages recently unmapped. But leave vma->vm_flags as it was,
* so KSM can come around to merge on vma and new_vma afterwards.
*/
- if (ksm_madvise(vma, old_addr, old_addr + old_len,
- MADV_UNMERGEABLE, &vm_flags))
- return -ENOMEM;
+ err = ksm_madvise(vma, old_addr, old_addr + old_len,
+ MADV_UNMERGEABLE, &vm_flags);
+ if (err)
+ return err;
new_pgoff = vma->vm_pgoff + ((old_addr - vma->vm_start) >> PAGE_SHIFT);
new_vma = copy_vma(&vma, new_addr, new_len, new_pgoff);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-09-05 21:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-05 21:22 [PATCH 1/3] ksm: clean up obsolete references Hugh Dickins
2009-09-05 21:25 ` [PATCH 2/3] ksm: unmerge is an origin of OOMs Hugh Dickins
2009-09-07 16:42 ` Izik Eidus
2009-09-07 16:42 ` Izik Eidus
2009-09-05 21:26 ` Hugh Dickins [this message]
2009-09-07 16:54 ` [PATCH 3/3] ksm: mremap use err from ksm_madvise Izik Eidus
2009-09-07 16:36 ` [PATCH 1/3] ksm: clean up obsolete references Izik Eidus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0909052225250.7387@sister.anvils \
--to=hugh.dickins@tiscali.co.uk \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ieidus@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox