diff mbox series

[04/16] block: don't bloat enter_queue with percpu_ref

Message ID 49bff6b10644a6c789414bf72452edb7d54c132f.1634676157.git.asml.silence@gmail.com (mailing list archive)
State New, archived
Headers show
Series block optimisation round | expand

Commit Message

Pavel Begunkov Oct. 19, 2021, 9:24 p.m. UTC
percpu_ref_put() are inlined for performance and bloat the binary, we
don't care about the fail case of blk_try_enter_queue(), so we can
replace it with a call to blk_queue_exit().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 block/blk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chaitanya Kulkarni Oct. 19, 2021, 10:32 p.m. UTC | #1
On 10/19/21 2:24 PM, Pavel Begunkov wrote:
> External email: Use caution opening links or attachments
> 
> 
> percpu_ref_put() are inlined for performance and bloat the binary, we
> don't care about the fail case of blk_try_enter_queue(), so we can
> replace it with a call to blk_queue_exit().
> 
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Christoph Hellwig Oct. 20, 2021, 6:12 a.m. UTC | #2
On Tue, Oct 19, 2021 at 10:24:13PM +0100, Pavel Begunkov wrote:
> percpu_ref_put() are inlined for performance and bloat the binary, we
> don't care about the fail case of blk_try_enter_queue(), so we can
> replace it with a call to blk_queue_exit().

Does this make a difference for you?

That being said using the proper helpers always seems like a good idea,
so:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Pavel Begunkov Oct. 20, 2021, 12:08 p.m. UTC | #3
On 10/20/21 07:12, Christoph Hellwig wrote:
> On Tue, Oct 19, 2021 at 10:24:13PM +0100, Pavel Begunkov wrote:
>> percpu_ref_put() are inlined for performance and bloat the binary, we
>> don't care about the fail case of blk_try_enter_queue(), so we can
>> replace it with a call to blk_queue_exit().

Thanks for going through the series!

> Does this make a difference for you?

It did with a different compiler with extra patches and a different
base, but checking with for-5.16/block the binary size stays the same.


> That being said using the proper helpers always seems like a good idea,
> so:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index c1ba34777c6d..88752e51d2b6 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -404,7 +404,7 @@  static bool blk_try_enter_queue(struct request_queue *q, bool pm)
 	return true;
 
 fail_put:
-	percpu_ref_put(&q->q_usage_counter);
+	blk_queue_exit(q);
 fail:
 	rcu_read_unlock();
 	return false;