Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6631e635 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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: default avatarJens Axboe <jaxboe@fusionio.com>
Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a626ca6a
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -4111,19 +4111,19 @@ asmlinkage void __sched schedule(void)
					try_to_wake_up_local(to_wakeup);
					try_to_wake_up_local(to_wakeup);
			}
			}
			deactivate_task(rq, prev, DEQUEUE_SLEEP);
			deactivate_task(rq, prev, DEQUEUE_SLEEP);
		}
		switch_count = &prev->nvcsw;
	}


			/*
			/*
			 * If we are going to sleep and we have plugged IO queued, make
			 * If we are going to sleep and we have plugged IO queued, make
			 * sure to submit it to avoid deadlocks.
			 * sure to submit it to avoid deadlocks.
			 */
			 */
	if (prev->state != TASK_RUNNING && blk_needs_flush_plug(prev)) {
			if (blk_needs_flush_plug(prev)) {
				raw_spin_unlock(&rq->lock);
				raw_spin_unlock(&rq->lock);
				blk_flush_plug(prev);
				blk_flush_plug(prev);
				raw_spin_lock(&rq->lock);
				raw_spin_lock(&rq->lock);
			}
			}
		}
		switch_count = &prev->nvcsw;
	}


	pre_schedule(rq, prev);
	pre_schedule(rq, prev);