From: Matthew Wilcox <willy@infradead.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+8b23309d5788a79d3eea@syzkaller.appspotmail.com,
syzbot+004c1e0fced2b4bc3dcc@syzkaller.appspotmail.com,
stable@vger.kernel.org
Subject: Re: [PATCH] block: Fix iterating over an empty bio with bio_for_each_folio_all
Date: Fri, 19 Jan 2024 16:03:53 +0000 [thread overview]
Message-ID: <ZaqdaYzEm--W8mti@casper.infradead.org> (raw)
In-Reply-To: <170544262659.494117.14502342650352587808.b4-ty@kernel.dk>
On Tue, Jan 16, 2024 at 03:03:46PM -0700, Jens Axboe wrote:
>
> On Tue, 16 Jan 2024 21:29:59 +0000, Matthew Wilcox (Oracle) wrote:
> > If the bio contains no data, bio_first_folio() calls page_folio() on a
> > NULL pointer and oopses. Move the test that we've reached the end of
> > the bio from bio_next_folio() to bio_first_folio().
> >
> >
>
> Applied, thanks!
>
> [1/1] block: Fix iterating over an empty bio with bio_for_each_folio_all
> commit: 7bed6f3d08b7af27b7015da8dc3acf2b9c1f21d7
I see you added an unlikely(), and I'm not sure it's justified.
It's going to be true at the end of each iteration. For a bio that
contains one bio_vec, it will be false once and true once. It'd be like
writing a for loop as:
for (i = 0; likely(i < n); i++) {
}
which I've never seen us do.
I don't know that it's worth taking out, but I wouldn't've put it in.
I wouldn't be surprised to see benchmarks show it's a bad idea.
Could you at least _say_ when you're going to make that kind of change?
I wouldn't've noticed except that I got a merge conflict.
prev parent reply other threads:[~2024-01-19 16:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 21:29 Matthew Wilcox (Oracle)
2024-01-16 22:03 ` Jens Axboe
2024-01-19 16:03 ` Matthew Wilcox [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=ZaqdaYzEm--W8mti@casper.infradead.org \
--to=willy@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+004c1e0fced2b4bc3dcc@syzkaller.appspotmail.com \
--cc=syzbot+8b23309d5788a79d3eea@syzkaller.appspotmail.com \
/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
all inboxes | Powered by JetHome®