mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	blk-mq: account higher order dispatch
We currently account a '0' dispatch, and anything above that still falls
below the range set by BLK_MQ_MAX_DISPATCH_ORDER. If we dispatch more,
we don't account it.
Change the last bucket to be inclusive of anything above the range we
track, and have the sysfs file reflect that by including a '+' in the
output:
$ cat /sys/block/nvme0n1/mq/0/dispatched
        0	1006
        1	20229
        2	1
        4	0
        8	0
       16	0
       32+	0
Signed-off-by: Jens Axboe <axboe@fb.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
			
			
This commit is contained in:
		
							parent
							
								
									2849450ad3
								
							
						
					
					
						commit
						703fd1c0f1
					
				
					 2 changed files with 14 additions and 7 deletions
				
			
		|  | @ -208,12 +208,14 @@ static ssize_t blk_mq_hw_sysfs_dispatched_show(struct blk_mq_hw_ctx *hctx, | ||||||
| 
 | 
 | ||||||
| 	page += sprintf(page, "%8u\t%lu\n", 0U, hctx->dispatched[0]); | 	page += sprintf(page, "%8u\t%lu\n", 0U, hctx->dispatched[0]); | ||||||
| 
 | 
 | ||||||
| 	for (i = 1; i < BLK_MQ_MAX_DISPATCH_ORDER; i++) { | 	for (i = 1; i < BLK_MQ_MAX_DISPATCH_ORDER - 1; i++) { | ||||||
| 		unsigned long d = 1U << (i - 1); | 		unsigned int d = 1U << (i - 1); | ||||||
| 
 | 
 | ||||||
| 		page += sprintf(page, "%8lu\t%lu\n", d, hctx->dispatched[i]); | 		page += sprintf(page, "%8u\t%lu\n", d, hctx->dispatched[i]); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	page += sprintf(page, "%8u+\t%lu\n", 1U << (i - 1), | ||||||
|  | 						hctx->dispatched[i]); | ||||||
| 	return page - start_page; | 	return page - start_page; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -789,6 +789,14 @@ static void flush_busy_ctxs(struct blk_mq_hw_ctx *hctx, struct list_head *list) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static inline unsigned int queued_to_index(unsigned int queued) | ||||||
|  | { | ||||||
|  | 	if (!queued) | ||||||
|  | 		return 0; | ||||||
|  | 
 | ||||||
|  | 	return min(BLK_MQ_MAX_DISPATCH_ORDER - 1, ilog2(queued) + 1); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Run this hardware queue, pulling any software queues mapped to it in. |  * Run this hardware queue, pulling any software queues mapped to it in. | ||||||
|  * Note that this function currently has various problems around ordering |  * Note that this function currently has various problems around ordering | ||||||
|  | @ -877,10 +885,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) | ||||||
| 			dptr = &driver_list; | 			dptr = &driver_list; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!queued) | 	hctx->dispatched[queued_to_index(queued)]++; | ||||||
| 		hctx->dispatched[0]++; |  | ||||||
| 	else if (queued < (1 << (BLK_MQ_MAX_DISPATCH_ORDER - 1))) |  | ||||||
| 		hctx->dispatched[ilog2(queued) + 1]++; |  | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Any items that need requeuing? Stuff them into hctx->dispatch, | 	 * Any items that need requeuing? Stuff them into hctx->dispatch, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Jens Axboe
						Jens Axboe