Subject: patch for conflict in mm/memory.c in 2.6.27.52
From: Corey Wright <undefined@pobox.com>
Date: Fri, 20 Aug 2010 20:01:23 -0500
Fri, 20 Aug 2010 20:01:23 -0500
the recent 2.6.27.52 conflicts with patch-2.6.27.48-vs2.3.0.36.9.diff in
mm/memory.c and attached is my attempt at resolving the conflict.

2.6.27.52 adds check_stack_guard_page() to do_anonymous_page() right before
anon_vma_prepare(), which conflicts with linux-vserver's addition of
vx_rss_avail() in the same location.  which one should be first or does it
matter at all)?

my guess, as reflected in the attached patch, is check_stack_guard_page()
then vx_rss_avail() (because check_stack_guard_page() is more important
than vx_rss_avail(), so check it first). if i'm wrong (or even right, but
for the wrong reason), then please let me know why, as i'm interested in
learning.

corey
-- 
undefined@pobox.com


--- linux-2.6.27.52/mm/memory.c	2010-08-20 17:59:24.000000000 -0500
+++ linux-2.6.27.52-vs2.3.0.36.9/mm/memory.c	2010-08-20 19:56:34.000000000 -0500
@@ -2434,6 +2442,9 @@ static int do_anonymous_page(struct mm_s
 	if (check_stack_guard_page(vma, address) < 0)
 		return VM_FAULT_SIGBUS;
 
+	if (!vx_rss_avail(mm, 1))
+		goto oom;
+
 	/* Allocate our own private page. */
 	if (unlikely(anon_vma_prepare(vma)))
 		goto oom;