Re: [PATCH v3 04/10] block: introduce dma map backed bio type
David Laight <[email protected]>
| Newsgroups | org.kernel.vger.io-uring,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-nvme,org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media |
|---|---|
| Message-ID | <20260519102148.21d42afc@pumpkin> |
On Mon, 18 May 2026 11:29:54 +0100 Pavel Begunkov <[email protected]> wrote: > On 5/13/26 09:19, Christoph Hellwig wrote: > >> + if (!bio_flagged(bio_src, BIO_DMABUF_MAP)) { > >> + bio->bi_io_vec = bio_src->bi_io_vec; > >> + } else { > >> + bio->dmabuf_map = bio_src->dmabuf_map; > >> + bio_set_flag(bio, BIO_DMABUF_MAP); > >> + } > > > > This is backwards, please avoid pointless negations: > > I can flip it, but compilers tend to prefer the true branch. E.g. this > > if (cond) A; else B; > C; > > can get compiled into: > > jmpcc cond B > A: ... > C: > return; > B: ... > jmp C; I'm pretty sure gcc completely ignores the order. Some very old compilers didn't - to the extreme of generating a short conditional branch around a long unconditional branch to get past a large 'true' code block. likely() and unlikely() can change things, they are definitely useful comments to a human (or Human) reader. I'm not sure you can rely on the branch predictor to do anything sensible outside of a loop. -- David