summaryrefslogtreecommitdiff
path: root/include/linux/blk-mq.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-10-06 06:34:11 -0600
committerJens Axboe <axboe@kernel.dk>2021-10-18 06:17:03 -0600
commit47c122e35d7e43b14129ceb9ed3a7e67599978fa (patch)
treea5c654c821d3b1bc49595a2e442d3ae3825e4919 /include/linux/blk-mq.h
parentba0ffdd8ce48ad7f7e85191cd29f9674caca3745 (diff)
block: pre-allocate requests if plug is started and is a batch
The caller typically has a good (or even exact) idea of how many requests it needs to submit. We can make the request/tag allocation a lot more efficient if we just allocate N requests/tags upfront when we queue the first bio from the batch. Provide a new plug start helper that allows the caller to specify how many IOs are expected. This sets plug->nr_ios, and we can use that for smarter request allocation. The plug provides a holding spot for requests, and request allocation will check it before calling into the normal request allocation path. The blk_finish_plug() is called, check if there are unused requests and free them. This should not happen in normal operations. The exception is if we get merging, then we may be left with requests that need freeing when done. This raises the per-core performance on my setup from ~5.8M to ~6.1M IOPS. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blk-mq.h')
-rw-r--r--include/linux/blk-mq.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 75d75657df21..0e941f217578 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -90,7 +90,10 @@ struct request {
struct bio *bio;
struct bio *biotail;
- struct list_head queuelist;
+ union {
+ struct list_head queuelist;
+ struct request *rq_next;
+ };
/*
* The hash is used inside the scheduler, and killed once the