[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZaqdaYzEm--W8mti@casper.infradead.org>
Date: Fri, 19 Jan 2024 16:03:53 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Jens Axboe <axboe@...nel.dk>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+8b23309d5788a79d3eea@...kaller.appspotmail.com,
syzbot+004c1e0fced2b4bc3dcc@...kaller.appspotmail.com,
stable@...r.kernel.org
Subject: Re: [PATCH] block: Fix iterating over an empty bio with
bio_for_each_folio_all
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.
Powered by blists - more mailing lists