From: Jens Axboe <axboe@kernel.dk>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] block: Remove unnecessary unlikely()
Date: Fri, 19 Jan 2024 13:20:05 -0700 [thread overview]
Message-ID: <3469483c-baf9-4df9-93ca-e5d8a1350511@kernel.dk> (raw)
In-Reply-To: <fe1f4fe8-48d8-4b09-bd50-36e8fd8e75cb@kernel.dk>
On 1/19/24 9:41 AM, Jens Axboe wrote:
> On 1/19/24 9:34 AM, Matthew Wilcox (Oracle) wrote:
>> Jens added unlikely() thinking that this was an error path. It's
>> actually just the end of the iteration, so does not warrant an
>> unlikely().
>
> This is because the previous fix (or my attempt at least) didn't do the
> i >= vcnt, it checked for an empty bio instead. Which then definitely
> did make it an error/unlikely path, but obviously this one is not.
Just out of curiosity, I did some branch profiling on just normal
operations of on my box. Of the ~900K times we hit this path,
10% of them ended up in that branch, and 90% of them did not.
While it's not an error path, that does seem rather unlikely. Sure, for
single entries, it'll be hit 50% of the time, but for most normal IO
it'd definitely be less than 50%, and as per above non-scientif
profiling, it's around 10%.
--
Jens Axboe
prev parent reply other threads:[~2024-01-19 20:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 16:34 [PATCH] block: Remove unnecessary unlikely() Matthew Wilcox (Oracle)
2024-01-19 16:41 ` Jens Axboe
2024-01-19 20:20 ` Jens Axboe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3469483c-baf9-4df9-93ca-e5d8a1350511@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox