Add basic support for polling for specific IO to complete. This uses the cookie that blk-mq passes back, which enables the block layer to pass this cookie to the driver to spin for a specific request. This will be combined with request latency tracking, so we can make qualified decisions about when to poll and when not to. For now, for benchmark purposes, we add a sysfs file that controls whether polling is enabled or not.
Showing the changes to include/linux/blkdev.h (1 of 5 files). Show all
Unified · Split
| @@ -487,6 +487,7 @@ struct request_queue { · 486 unmodified lines | |||
| 487 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ | 487 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ |
| 488 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ | 488 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ |
| 489 | #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ | 489 | #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ |
| 490 | #define QUEUE_FLAG_POLL 22 /* IO polling enabled if set */ | ||
| 490 | 491 | ||
| 491 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 492 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 492 | (1 << QUEUE_FLAG_STACKABLE) | \ | 493 | (1 << QUEUE_FLAG_STACKABLE) | \ |
| @@ -814,6 +815,8 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *, · 321 unmodified lines | |||
| 814 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | 815 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |
| 815 | struct request *, int, rq_end_io_fn *); | 816 | struct request *, int, rq_end_io_fn *); |
| 816 | 817 | ||
| 818 | bool blk_poll(struct request_queue *q, blk_qc_t cookie); | ||
| 819 | |||
| 817 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | 820 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) |
| 818 | { | 821 | { |
| 819 | return bdev->bd_disk->queue; /* this is never NULL */ | 822 | return bdev->bd_disk->queue; /* this is never NULL */ |