Skip to contentSkip to conversation

blk-mq: change bio_set_ioprio to inline

RFC PATCH In review Liu Song 3 participants 7 messages Aug 30, 2022 – Aug 31, 2022 Block layer

lore
Share & tools
lore

Liu Song

author
#0 lore raw

RFC PATCH 1/1 blk-mq: change bio_set_ioprio to inline

From: Liu Song <[email protected]>

Change "bio_set_ioprio" to inline to avoid calling overhead.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
index c96c8c4..a17bc83 100644
@@ -2766,7 +2766,7 @@ static inline struct request *blk_mq_get_cached_request(struct request_queue *q,
 	return rq;
 }
 
-static void bio_set_ioprio(struct bio *bio)
+static inline void bio_set_ioprio(struct bio *bio)
 {
 	/* Nobody set ioprio so far? Initialize it based on task's nice value */
 	if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
Signature · 1 line
1.8.3.1
author
#2 lore raw
Quoted 10 lines · Chaitanya Kulkarni
Quoted 5 lines · Liu Song

From: Liu Song <[email protected]>

Change "bio_set_ioprio" to inline to avoid calling overhead.

for performance overhead please provide quantitative data

-ck

This is a small adjustment, and even if performance comparison data is obtained for targeted design use cases, it is not universal. If the inline by the compiler is successful, the number of instructions will be reduced.

Thanks

Quoted 1 line
maintainer
#3 lore raw
In reply to Liu Song
Quoted 3 lines · Liu Song

From: Liu Song <[email protected]>

Change "bio_set_ioprio" to inline to avoid calling overhead.

Let's not try to 2nd guess the compiler here. Most things that are marked inline should not be.

Signature · 1 line
Jens Axboe
author
#4 lore raw
Quoted 6 lines · Jens Axboe
Quoted 3 lines · Liu Song

From: Liu Song <[email protected]>

Change "bio_set_ioprio" to inline to avoid calling overhead.

Let's not try to 2nd guess the compiler here. Most things that are marked inline should not be.

Agree, I think there is something wrong with the commit log written here, it should be expected to reduce the call overhead, bio_set_ioprio seems to be appropriate to use inline.

Thanks

Quoted 1 line
maintainer
#5 lore raw
Quoted 11 lines · Liu Song
Quoted 6 lines · Jens Axboe
Quoted 3 lines · Liu Song

From: Liu Song <[email protected]>

Change "bio_set_ioprio" to inline to avoid calling overhead.

Let's not try to 2nd guess the compiler here. Most things that are marked inline should not be.

Agree, I think there is something wrong with the commit log written here, it should be expected to reduce the call overhead, bio_set_ioprio seems to be appropriate to use inline.

I'm sure it's worth inlining, but did you check if it isn't already? If it's small I'd fully expect the compiler to inline it already, without needing to add things to do so.

Signature · 1 line
Jens Axboe
author
#6 lore raw
Quoted 6 lines · Jens Axboe
Quoted 5 lines · Liu Song
Quoted 4 lines · Jens Axboe
Quoted 3 lines · Liu Song

From: Liu Song <[email protected]>

Change "bio_set_ioprio" to inline to avoid calling overhead.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Let's not try to 2nd guess the compiler here. Most things that are marked inline should not be.

Agree, I think there is something wrong with the commit log written here, it should be expected to reduce the call overhead, bio_set_ioprio seems to be appropriate to use inline.

I'm sure it's worth inlining, but did you check if it isn't already? If it's small I'd fully expect the compiler to inline it already, without needing to add things to do so.

It is indeed possible, thanks for your reply.

Thanks