diff mbox series

[RFC,v2,2/3] blk-mq: Change request->csd type to call_single_data_t

Message ID 20230520052957.798486-3-leobras@redhat.com (mailing list archive)
State New, archived
Headers show
Series Move usages of struct __call_single_data to call_single_data_t | expand

Commit Message

Leonardo Bras May 20, 2023, 5:29 a.m. UTC
Currently, request->csd has type struct __call_single_data.

call_single_data_t is defined in include/linux/smp.h :

/* Use __aligned() to avoid to use 2 cache lines for 1 csd */
typedef struct __call_single_data call_single_data_t
        __aligned(sizeof(struct __call_single_data));

This is proposed this way so it avoids doing 2 cacheline bounce when
running a csd request.

Changing request->csd to the aligned typedef was previously attempted in
commit 966a967116e6 ("smp: Avoid using two cache lines for struct call_single_data")
but at the time the union that contains csd was positioned near the top of
struct request, only below a struct list_head, and this caused the issue of
holes summing up 24 extra bytes in struct request.

The struct size was restored back to normal by
commit 4ccafe032005 ("block: unalign call_single_data in struct request")
but it caused the csd to be possibly split in 2 cachelines again.

Since request->csd was moved to be always 32-byte aligned inside
'struct request', changing it to the aligned typedef should not cause
any increased size or hole in the struct.

Since this is the last use of the unaligned struct outside smp code, having
this changed will allow us to change smp_call_function_single_async() to
only accept the aligned typedef, and avoid undesired extra cacheline
bounce in future code.

Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
 include/linux/blk-mq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 44201e18681f..6033ef8eb4eb 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -107,7 +107,7 @@  struct request {
 	struct block_device *part;
 
 	union {
-		struct __call_single_data csd;
+		call_single_data_t csd;
 		u64 fifo_time;
 	};
 #ifdef CONFIG_BLK_RQ_ALLOC_TIME