2022-08-30 09:58:06

by Liu Song

[permalink] [raw]
Subject: [RFC PATCH] blk-mq: change bio_set_ioprio to inline

From: Liu Song <[email protected]>

Change "bio_set_ioprio" to inline to avoid calling overhead.

Signed-off-by: Liu Song <[email protected]>
---
block/blk-mq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index c96c8c4..a17bc83 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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)
--
1.8.3.1


2022-08-30 13:36:04

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [RFC PATCH] blk-mq: change bio_set_ioprio to inline

On 8/30/22 02:45, Liu Song wrote:
> From: Liu Song <[email protected]>
>
> Change "bio_set_ioprio" to inline to avoid calling overhead.
>
> Signed-off-by: Liu Song <[email protected]>

for performance overhead please provide quantitative data

-ck



2022-08-30 14:25:13

by Jens Axboe

[permalink] [raw]
Subject: Re: [RFC PATCH] blk-mq: change bio_set_ioprio to inline

On 8/30/22 3:45 AM, Liu Song wrote:
> 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.

--
Jens Axboe


2022-08-31 01:07:05

by Liu Song

[permalink] [raw]
Subject: Re: [RFC PATCH] blk-mq: change bio_set_ioprio to inline

On 2022/8/30 20:48, Chaitanya Kulkarni wrote:

> On 8/30/22 02:45, Liu Song wrote:
>> From: Liu Song <[email protected]>
>>
>> Change "bio_set_ioprio" to inline to avoid calling overhead.
>>
>> Signed-off-by: Liu Song <[email protected]>
> 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

>

2022-08-31 01:08:03

by Jens Axboe

[permalink] [raw]
Subject: Re: [RFC PATCH] blk-mq: change bio_set_ioprio to inline

On 8/30/22 6:42 PM, Liu Song wrote:
>
> On 2022/8/30 21:59, Jens Axboe wrote:
>> On 8/30/22 3:45 AM, Liu Song wrote:
>>> 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.

--
Jens Axboe


2022-08-31 01:19:23

by Liu Song

[permalink] [raw]
Subject: Re: [RFC PATCH] blk-mq: change bio_set_ioprio to inline


On 2022/8/30 21:59, Jens Axboe wrote:
> On 8/30/22 3:45 AM, Liu Song wrote:
>> 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

>

2022-08-31 01:35:33

by Liu Song

[permalink] [raw]
Subject: Re: [RFC PATCH] blk-mq: change bio_set_ioprio to inline


On 2022/8/31 08:59, Jens Axboe wrote:
> On 8/30/22 6:42 PM, Liu Song wrote:
>> On 2022/8/30 21:59, Jens Axboe wrote:
>>> On 8/30/22 3:45 AM, Liu Song wrote:
>>>> 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.
>
It is indeed possible, thanks for your reply.

Thanks