summaryrefslogtreecommitdiffstats
path: root/block/blk-tag.c
diff options
context:
space:
mode:
authorPaolo Valente <paolo.valente@linaro.org>2018-05-04 19:17:01 +0200
committerJens Axboe <axboe@kernel.dk>2018-05-10 10:16:29 -0600
commit18e5a57d79878b205d39b2f160082d9098e9bfd6 (patch)
tree9b93a456b6dd8c70d7a14d0096f972f9f4de8d63 /block/blk-tag.c
parent8e3c283fc652df38140ce45189de204b47fc3e17 (diff)
downloadlinux-0-day-18e5a57d79878b205d39b2f160082d9098e9bfd6.tar.gz
linux-0-day-18e5a57d79878b205d39b2f160082d9098e9bfd6.tar.xz
block, bfq: postpone rq preparation to insert or merge
When invoked for an I/O request rq, the prepare_request hook of bfq increments reference counters in the destination bfq_queue for rq. In this respect, after this hook has been invoked, rq may still be transformed into a request with no icq attached, i.e., for bfq, a request not associated with any bfq_queue. No further hook is invoked to signal this tranformation to bfq (in general, to the destination elevator for rq). This leads bfq into an inconsistent state, because bfq has no chance to correctly lower these counters back. This inconsistency may in its turn cause incorrect scheduling and hangs. It certainly causes memory leaks, by making it impossible for bfq to free the involved bfq_queue. On the bright side, no transformation can still happen for rq after rq has been inserted into bfq, or merged with another, already inserted, request. Exploiting this fact, this commit addresses the above issue by delaying the preparation of an I/O request to when the request is inserted or merged. This change also gives a performance bonus: a lock-contention point gets removed. To prepare a request, bfq needs to hold its scheduler lock. After postponing request preparation to insertion or merging, no lock needs to be grabbed any longer in the prepare_request hook, while the lock already taken to perform insertion or merging is used to preparare the request as well. Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Tested-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-tag.c')
0 files changed, 0 insertions, 0 deletions