mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
block: defer flush request no matter whether we have elevator
Commit7520872c0c
("block: don't defer flushes on blk-mq + scheduling") tried to fix deadlock for cycled wait between flush requests and data request into flush_data_in_flight. The former holded all driver tags and wait for data request completion, but the latter can not complete for waiting free driver tags. After commit923218f616
("blk-mq: don't allocate driver tag upfront for flush rq"), flush requests will not get driver tag before queuing into flush queue. * With elevator, flush request just get sched_tags before inserting flush queue. It will not get driver tag until issue them to driver. data request on list fq->flush_data_in_flight will complete in the end. * Without elevator, each flush request will get a driver tag when allocate request. Then data request on fq->flush_data_in_flight don't worry about lacking driver tag. In both of these cases, cycled wait cannot be true. So we may allow to defer flush request. Signed-off-by: Yufen Yu <yuyufen@huawei.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -283,13 +283,8 @@ static void blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,
|
|||||||
if (fq->flush_pending_idx != fq->flush_running_idx || list_empty(pending))
|
if (fq->flush_pending_idx != fq->flush_running_idx || list_empty(pending))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* C2 and C3
|
/* C2 and C3 */
|
||||||
*
|
if (!list_empty(&fq->flush_data_in_flight) &&
|
||||||
* For blk-mq + scheduling, we can risk having all driver tags
|
|
||||||
* assigned to empty flushes, and we deadlock if we are expecting
|
|
||||||
* other requests to make progress. Don't defer for that case.
|
|
||||||
*/
|
|
||||||
if (!list_empty(&fq->flush_data_in_flight) && q->elevator &&
|
|
||||||
time_before(jiffies,
|
time_before(jiffies,
|
||||||
fq->flush_pending_since + FLUSH_PENDING_TIMEOUT))
|
fq->flush_pending_since + FLUSH_PENDING_TIMEOUT))
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user