From: Hillf Danton <dhillf@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
Hugh Dickins <hughd@google.com>,
Johannes Weiner <jweiner@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org
Subject: [PATCH] mmap: fix loop when adjusting vma
Date: Fri, 11 Nov 2011 20:53:23 +0800 [thread overview]
Message-ID: <CAJd=RBAhHS4txg-2tnJyER=GeT4X95z6COMzJvRhcwFgXu6oOA@mail.gmail.com> (raw)
If we have more work to do after one vma is removed, we have to reload @end in
case it is clobbered, then try again.
Thanks
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
--- a/mm/mmap.c Fri Nov 11 20:35:46 2011
+++ b/mm/mmap.c Fri Nov 11 20:41:32 2011
@@ -490,6 +490,7 @@ __vma_unlink(struct mm_struct *mm, struc
int vma_adjust(struct vm_area_struct *vma, unsigned long start,
unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert)
{
+ unsigned long saved_end = end;
struct mm_struct *mm = vma->vm_mm;
struct vm_area_struct *next = vma->vm_next;
struct vm_area_struct *importer = NULL;
@@ -634,7 +635,14 @@ again: remove_next = 1 + (end > next->
*/
if (remove_next == 2) {
next = vma->vm_next;
- goto again;
+ if (next) {
+ /*
+ * we have more work, reload @end in case
+ * it is clobbered.
+ */
+ end = saved_end;
+ goto again;
+ }
}
}
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2011-11-11 12:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-11 12:53 Hillf Danton [this message]
2011-11-11 17:24 ` Andrea Arcangeli
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='CAJd=RBAhHS4txg-2tnJyER=GeT4X95z6COMzJvRhcwFgXu6oOA@mail.gmail.com' \
--to=dhillf@gmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=jweiner@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