linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mmap: feed back correct prev vma when finding vma
@ 2012-08-09 12:21 Hillf Danton
  2012-08-10  1:26 ` Hugh Dickins
  0 siblings, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2012-08-09 12:21 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Hugh Dickins, Mikulas Patocka, Andrew Morton, LKML, Linux-MM,
	Hillf Danton

After walking rb tree, if vma is determined, prev vma has to be determined
based on vma; and rb_prev should be considered only if no vma determined.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/mmap.c	Fri Aug  3 07:38:10 2012
+++ b/mm/mmap.c	Mon Aug  6 20:10:18 2012
@@ -385,9 +385,13 @@ find_vma_prepare(struct mm_struct *mm, u
 		}
 	}

-	*pprev = NULL;
-	if (rb_prev)
-		*pprev = rb_entry(rb_prev, struct vm_area_struct, vm_rb);
+	if (vma) {
+		*pprev = vma->vm_prev;
+	} else {
+		*pprev = NULL;
+		if (rb_prev)
+			*pprev = rb_entry(rb_prev, struct vm_area_struct, vm_rb);
+	}
 	*rb_link = __rb_link;
 	*rb_parent = __rb_parent;
 	return vma;
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-14 11:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-09 12:21 [patch] mmap: feed back correct prev vma when finding vma Hillf Danton
2012-08-10  1:26 ` Hugh Dickins
2012-08-10 12:00   ` Hillf Danton
2012-08-14  2:17     ` Hugh Dickins
2012-08-14 11:56       ` Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).