David Howells wrote on Tue, Aug 12, 2025 at 10:38:07AM +0100:
@@ -168,6 +168,8 @@ size_t iterate_folioq(struct iov_iter *i break; fsize = folioq_folio_size(folioq, slot);
base = kmap_local_folio(folio, skip); part = umin(len, PAGE_SIZE - skip % PAGE_SIZE); remain = step(base, progress, part, priv, priv2);if (skip < fsize) {
@@ -177,6 +179,7 @@ size_t iterate_folioq(struct iov_iter *i progress += consumed; skip += consumed;
if (skip >= fsize) { skip = 0; slot++; if (slot == folioq_nr_slots(folioq) && folioq->next) {}
With the stuff inside the braces suitably indented. The compiler should be able to optimise away the extra comparison.
skip is modified in the first if so I don't see how the compiler could optimize it. I just checked and at least iov_iter.o is slightly bigger with a second if:
(a.o = goto, b.o = if) 06:17:52 asmadeus@thor 0 ~/code/linux/bb$ size a.o b.o text data bss dec hex filename 26923 1104 0 28027 6d7b a.o 27019 1104 0 28123 6ddb b.o
but honestly I'm happy to focus on readability here -- if you think two if are easier to read I'll be happy to send a v3