summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-04-13 08:08:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-13 08:08:20 -0700
commit6631e635c65dc33cb798cc2f51d0ddd69ada6319 (patch)
treec71585118b3ddd42b1bf666fef9f96e60b79f757
parenta626ca6a656450e9f4df91d0dda238fff23285f4 (diff)
downloadop-kernel-dev-6631e635c65dc33cb798cc2f51d0ddd69ada6319.zip
op-kernel-dev-6631e635c65dc33cb798cc2f51d0ddd69ada6319.tar.gz
block: don't flush plugged IO on forced preemtion scheduling
We really only want to unplug the pending IO when the process actually goes to sleep. So move the test for flushing the plug up to the place where we actually deactivate the task - where we have properly checked for preemption and for the process really sleeping. Acked-by: Jens Axboe <jaxboe@fusionio.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/sched.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 4801363..a187c3f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4111,20 +4111,20 @@ need_resched:
try_to_wake_up_local(to_wakeup);
}
deactivate_task(rq, prev, DEQUEUE_SLEEP);
+
+ /*
+ * If we are going to sleep and we have plugged IO queued, make
+ * sure to submit it to avoid deadlocks.
+ */
+ if (blk_needs_flush_plug(prev)) {
+ raw_spin_unlock(&rq->lock);
+ blk_flush_plug(prev);
+ raw_spin_lock(&rq->lock);
+ }
}
switch_count = &prev->nvcsw;
}
- /*
- * If we are going to sleep and we have plugged IO queued, make
- * sure to submit it to avoid deadlocks.
- */
- if (prev->state != TASK_RUNNING && blk_needs_flush_plug(prev)) {
- raw_spin_unlock(&rq->lock);
- blk_flush_plug(prev);
- raw_spin_lock(&rq->lock);
- }
-
pre_schedule(rq, prev);
if (unlikely(!rq->nr_running))
OpenPOWER on IntegriCloud