--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Another patch based on a suggestion from Ben.
use_mm wasn't acquiring the task_lock - its possible this might
be causing a race with procps.

Let me know if this makes a difference.

Regards
Suparna

-- 
Suparna Bhattacharya (suparna@in.ibm.com)
Linux Technology Center
IBM Software Labs, India

--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="usemm-tasklock.patch"

diff -ur -X dontdiff 2572mm-pure/fs/aio.c linux-2.5.72-mm1/fs/aio.c


 fs/aio.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff -puN fs/aio.c~aio-take-task_lock fs/aio.c
--- 25/fs/aio.c~aio-take-task_lock	2003-08-30 15:42:32.000000000 -0700
+++ 25-akpm/fs/aio.c	2003-08-30 15:42:32.000000000 -0700
@@ -563,12 +563,16 @@ struct kioctx *lookup_ioctx(unsigned lon
  */
 static void use_mm(struct mm_struct *mm)
 {
-	struct mm_struct *active_mm = current->active_mm;
-	atomic_inc(&mm->mm_count);
-	current->mm = mm;
+	struct mm_struct *active_mm;
+	struct task_struct *tsk = current;
 
-	current->active_mm = mm;
+	task_lock(tsk);
+	active_mm = tsk->active_mm;
+	atomic_inc(&mm->mm_count);
+	tsk->mm = mm;
+	tsk->active_mm = mm;
 	activate_mm(active_mm, mm);
+	task_unlock(tsk);
 
 	mmdrop(active_mm);
 }
@@ -580,12 +584,19 @@ static void use_mm(struct mm_struct *mm)
  * 	by the calling kernel thread
  * 	(Note: this routine is intended to be called only
  * 	from a kernel thread context)
+ *
+ * Comments: Called with ctx->ctx_lock held. This nests
+ * task_lock instead ctx_lock.
  */
 void unuse_mm(struct mm_struct *mm)
 {
-	current->mm = NULL;
+	struct task_struct *tsk = current;
+
+	task_lock(tsk);
+	tsk->mm = NULL;
 	/* active_mm is still 'mm' */
-	enter_lazy_tlb(mm, current);
+	enter_lazy_tlb(mm, tsk);
+	task_unlock(tsk);
 }
 
 /*

_