mbox series

[PATCHSET,v2,0/2] Re-introduce iov/bio no page referencing

Message ID 20190228213642.306-1-axboe@kernel.dk (mailing list archive)
Headers show
Series Re-introduce iov/bio no page referencing | expand

Message

Jens Axboe Feb. 28, 2019, 9:36 p.m. UTC
The io_uring branch had a patch that enabled us to NOT get/put page
references on pages that we have registered from the application.
This patch assumed that it was safe to never do this for any ITER_BVEC,
but that turned out to be problematic for the splice direct case where
we stuff those pages into a pipe and unconditionally release them when
the pipe buffer is released.

This was fixed by always grabbing an extra page reference before doing
IO, and let the caller release that reference. However, this causes a
performance regressions since we're now doing an atomic inc/dec per
IO needlessly.

Instead of assuming that any ITER_BVEC caller knows not to put these
page references, have the caller explicitly flag it. This shifts the
iter types up a bit, so we can add a bit similar to the read/write bit
for managing this information.

Patch 2 then re-introduces the BIO_NO_PAGE_REF, which is now limited by
both ITER_BVEC _and_ the caller flagged it as safe.

Patches are on top of my io_uring branch.

Since v1:

- Add comment on the bit usages of iter->type
- Move ITER_BVEC_FLAG_NO_REF at the start of the enum
- Remove superfluous 'const' in iov_iter_bvec_no_ref()