mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
FROMLIST: block/mq-deadline: Only use zone locking if necessary
Measurements have shown that limiting the queue depth to one per zone for zoned writes has a significant negative performance impact on zoned UFS devices. Hence this patch that disables zone locking by the mq-deadline scheduler if the storage controller preserves the command order. This patch is based on the following assumptions: - It happens infrequently that zoned write requests are reordered by the block layer. - The I/O priority of all write requests is the same per zone. - Either no I/O scheduler is used or an I/O scheduler is used that serializes write requests per zone. Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Ming Lei <ming.lei@redhat.com> Change-Id: I2000beaa430f29ea1096149a7d3b8a5423b679ec Signed-off-by: Bart Van Assche <bvanassche@acm.org> Bug: 234829282 Link: https://lore.kernel.org/linux-block/20230804154821.3232094-1-bvanassche@acm.org/T/#made79fdd0e1d8d466f734250f3868b4d6f8105db Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
committed by
Bart Van Assche
parent
5414ea3f50
commit
4e1d1b839d
@@ -340,6 +340,16 @@ static struct request *deadline_skip_seq_writes(struct deadline_data *dd,
|
||||
return rq;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use write locking if either QUEUE_FLAG_NO_ZONE_WRITE_LOCK has not been set.
|
||||
* Not using zone write locking is only safe if the block driver preserves the
|
||||
* request order.
|
||||
*/
|
||||
static bool dd_use_zone_write_locking(struct request_queue *q)
|
||||
{
|
||||
return blk_queue_is_zoned(q) && !blk_queue_no_zone_write_lock(q);
|
||||
}
|
||||
|
||||
/*
|
||||
* For the specified data direction, return the next request to
|
||||
* dispatch using arrival ordered lists.
|
||||
@@ -355,7 +365,7 @@ deadline_fifo_request(struct deadline_data *dd, struct dd_per_prio *per_prio,
|
||||
return NULL;
|
||||
|
||||
rq = rq_entry_fifo(per_prio->fifo_list[data_dir].next);
|
||||
if (data_dir == DD_READ || !blk_queue_is_zoned(rq->q))
|
||||
if (data_dir == DD_READ || !dd_use_zone_write_locking(rq->q))
|
||||
return rq;
|
||||
|
||||
/*
|
||||
@@ -400,7 +410,7 @@ deadline_next_request(struct deadline_data *dd, struct dd_per_prio *per_prio,
|
||||
if (!rq)
|
||||
return NULL;
|
||||
|
||||
if (data_dir == DD_READ || !blk_queue_is_zoned(rq->q))
|
||||
if (data_dir == DD_READ || !dd_use_zone_write_locking(rq->q))
|
||||
return rq;
|
||||
|
||||
/*
|
||||
@@ -528,8 +538,9 @@ dispatch_find_request:
|
||||
}
|
||||
|
||||
/*
|
||||
* For a zoned block device, if we only have writes queued and none of
|
||||
* them can be dispatched, rq will be NULL.
|
||||
* For a zoned block device that requires write serialization, if we
|
||||
* only have writes queued and none of them can be dispatched, rq will
|
||||
* be NULL.
|
||||
*/
|
||||
if (!rq)
|
||||
return NULL;
|
||||
@@ -554,7 +565,8 @@ done:
|
||||
/*
|
||||
* If the request needs its target zone locked, do it.
|
||||
*/
|
||||
blk_req_zone_write_lock(rq);
|
||||
if (dd_use_zone_write_locking(rq->q))
|
||||
blk_req_zone_write_lock(rq);
|
||||
rq->rq_flags |= RQF_STARTED;
|
||||
return rq;
|
||||
}
|
||||
@@ -931,7 +943,7 @@ static void dd_finish_request(struct request *rq)
|
||||
|
||||
atomic_inc(&per_prio->stats.completed);
|
||||
|
||||
if (blk_queue_is_zoned(q)) {
|
||||
if (dd_use_zone_write_locking(rq->q)) {
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&dd->zone_lock, flags);
|
||||
|
||||
Reference in New Issue
Block a user