diff mbox series

[V2,2/2] block: move 'q_usage_counter' into front of 'request_queue'

Message ID 20200902122643.634143-3-ming.lei@redhat.com (mailing list archive)
State New, archived
Headers show
Series percpu_ref & block: reduce memory footprint of percpu_ref in fast path | expand

Commit Message

Ming Lei Sept. 2, 2020, 12:26 p.m. UTC
The field of 'q_usage_counter' is always fetched in fast path of every
block driver, and move it into front of 'request_queue', so it can be
fetched into 1st cacheline of 'request_queue' instance.

Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 include/linux/blkdev.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Sept. 2, 2020, 1:44 p.m. UTC | #1
On Wed, Sep 02, 2020 at 08:26:43PM +0800, Ming Lei wrote:
> The field of 'q_usage_counter' is always fetched in fast path of every
> block driver, and move it into front of 'request_queue', so it can be
> fetched into 1st cacheline of 'request_queue' instance.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d0d61bc81615..7575fa0aae6e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -397,6 +397,8 @@  struct request_queue {
 	struct request		*last_merge;
 	struct elevator_queue	*elevator;
 
+	struct percpu_ref	q_usage_counter;
+
 	struct blk_queue_stats	*stats;
 	struct rq_qos		*rq_qos;
 
@@ -567,7 +569,6 @@  struct request_queue {
 	 * percpu_ref_kill() and percpu_ref_reinit().
 	 */
 	struct mutex		mq_freeze_lock;
-	struct percpu_ref	q_usage_counter;
 
 	struct blk_mq_tag_set	*tag_set;
 	struct list_head	tag_set_list;