blk-mq-sched: support request batch dispatching for sq elevator#72
blk-mq-sched: support request batch dispatching for sq elevator#72blktests-ci[bot] wants to merge 6 commits intofor-next_basefrom
Conversation
|
Upstream branch: 4643847 |
|
Upstream branch: 4643847 |
f20ed73 to
0df9b3d
Compare
|
Upstream branch: 4643847 |
0df9b3d to
29fc3ae
Compare
45d9a85 to
b9951ab
Compare
|
Upstream branch: 43213b2 |
29fc3ae to
a4a57b7
Compare
b9951ab to
eda2eac
Compare
|
Upstream branch: 301d58c |
a4a57b7 to
3fccb24
Compare
7bf6dad to
0fb21b4
Compare
|
Upstream branch: 301d58c |
3fccb24 to
fbe38e8
Compare
0fb21b4 to
26415c4
Compare
|
Upstream branch: 301d58c |
fbe38e8 to
3049058
Compare
26415c4 to
3ffa704
Compare
|
Upstream branch: f1815af |
Currently, both mq-deadline and bfq have global spin lock that will be grabbed inside elevator methods like dispatch_request, insert_requests, and bio_merge. And the global lock is the main reason mq-deadline and bfq can't scale very well. While dispatching request, blk_mq_get_disatpch_budget() and blk_mq_get_driver_tag() must be called, and they are not ready to be called inside elevator methods, hence introduce a new method like dispatch_requests is not possible. Hence introduce a new high level elevator lock, currently it is protecting dispatch_request only. Following patches will convert mq-deadline and bfq to use this lock and finally support request batch dispatching by calling the method multiple time while holding the lock. Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
Replace the internal spinlock 'dd->lock' with the new spinlock in elevator_queue, there are no functional changes. Signed-off-by: Yu Kuai <[email protected]>
Replace the internal spinlock bfqd->lock with the new spinlock in elevator_queue. There are no functional changes. Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Hannes Reinecke <[email protected].
Introduce struct sched_dispatch_ctx, and split the helper into elevator_dispatch_one_request() and elevator_finish_dispatch(). Also and comments about the non-error return value. Make code cleaner, and make it easier to add a new branch to dispatch a batch of requests at a time in the next patch. Signed-off-by: Yu Kuai <[email protected]>
For dispatch_request method, current behavior is dispatching one request at
a time. In the case of multiple dispatching contexts, This behavior, on the
one hand, introduce intense lock contention:
t1: t2: t3:
lock lock lock
// grab lock
ops.dispatch_request
unlock
// grab lock
ops.dispatch_request
unlock
// grab lock
ops.dispatch_request
unlock
on the other hand, messing up the requests dispatching order:
t1:
lock
rq1 = ops.dispatch_request
unlock
t2:
lock
rq2 = ops.dispatch_request
unlock
lock
rq3 = ops.dispatch_request
unlock
lock
rq4 = ops.dispatch_request
unlock
//rq1,rq3 issue to disk
// rq2, rq4 issue to disk
In this case, the elevator dispatch order is rq 1-2-3-4, however,
such order in disk is rq 1-3-2-4, the order for rq2 and rq3 is inversed.
Fix those problems by introducing elevator_dispatch_requests(), this
helper will grab the lock and dispatch a batch of requests while holding
the lock.
Signed-off-by: Yu Kuai <[email protected]>
3049058 to
4162756
Compare
3ffa704 to
62f402e
Compare
Pull request for series with
subject: blk-mq-sched: support request batch dispatching for sq elevator
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=986960