Skip to contentSkip to conversation

use aio workqueue in fs/aio.c

PATCH New William Lee Irwin III 1 participant 2 messages Jun 1, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 use aio workqueue in fs/aio.c

Minor aio correction split off from suparna's patches:

Use the dedicated aio workqueue, not keventd, in order to isolate the rest of the system from aio's demands.

fs/aio.c +1 -1
Index: suparna-2.6.7-rc2/fs/aio.c
===================================================================
@@ -608,7 +608,7 @@
 		spin_lock_irqsave(&ctx->ctx_lock, flags);
 		list_add_tail(&iocb->ki_run_list, &ctx->run_list);
 		spin_unlock_irqrestore(&ctx->ctx_lock, flags);
-		schedule_work(&ctx->wq);
+		queue_work(aio_wq, &ctx->wq);
 	}
 }
 
#1 lore raw

PATCH 2/2 correct use_mm()/unuse_mm() to use task_lock() to protect ->mm

Split off from suparna's patches:

Correct use_mm()/unuse_mm() to use task_lock() to protect task->mm.

fs/aio.c +7 -1
Index: suparna-2.6.7-rc2/fs/aio.c
===================================================================
@@ -538,19 +538,25 @@
 
 static void use_mm(struct mm_struct *mm)
 {
-	struct mm_struct *active_mm = current->active_mm;
+	struct mm_struct *active_mm;
+
 	atomic_inc(&mm->mm_count);
+	task_lock(current);
+	active_mm = current->active_mm;
 	current->mm = mm;
 	if (mm != active_mm) {
 		current->active_mm = mm;
 		activate_mm(active_mm, mm);
 	}
+	task_unlock(current);
 	mmdrop(active_mm);
 }
 
 static void unuse_mm(struct mm_struct *mm)
 {
+	task_lock(current);
 	current->mm = NULL;
+	task_unlock(current);
 	/* active_mm is still 'mm' */
 	enter_lazy_tlb(mm, current);
 }