Commit 8b0c6025 authored by Jens Axboe's avatar Jens Axboe

io_uring/rsrc: get rid of io_mapped_ubuf->folio_mask

We don't really need to cache this, let's reclaim 8 bytes from struct
io_mapped_ubuf and just calculate it when we need it. The only hot path
here is io_import_fixed().
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 636119af
...@@ -988,13 +988,10 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov, ...@@ -988,13 +988,10 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
imu->ubuf_end = imu->ubuf + iov->iov_len; imu->ubuf_end = imu->ubuf + iov->iov_len;
imu->nr_bvecs = nr_pages; imu->nr_bvecs = nr_pages;
imu->folio_shift = PAGE_SHIFT; imu->folio_shift = PAGE_SHIFT;
imu->folio_mask = PAGE_MASK; if (coalesced)
if (coalesced) {
imu->folio_shift = data.folio_shift; imu->folio_shift = data.folio_shift;
imu->folio_mask = ~((1UL << data.folio_shift) - 1);
}
refcount_set(&imu->refs, 1); refcount_set(&imu->refs, 1);
off = (unsigned long) iov->iov_base & ~imu->folio_mask; off = (unsigned long) iov->iov_base & ((1UL << imu->folio_shift) - 1);
*pimu = imu; *pimu = imu;
ret = 0; ret = 0;
...@@ -1132,7 +1129,7 @@ int io_import_fixed(int ddir, struct iov_iter *iter, ...@@ -1132,7 +1129,7 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
iter->bvec = bvec + seg_skip; iter->bvec = bvec + seg_skip;
iter->nr_segs -= seg_skip; iter->nr_segs -= seg_skip;
iter->count -= bvec->bv_len + offset; iter->count -= bvec->bv_len + offset;
iter->iov_offset = offset & ~imu->folio_mask; iter->iov_offset = offset & ((1UL << imu->folio_shift) - 1);
} }
} }
......
...@@ -46,7 +46,6 @@ struct io_mapped_ubuf { ...@@ -46,7 +46,6 @@ struct io_mapped_ubuf {
unsigned int nr_bvecs; unsigned int nr_bvecs;
unsigned int folio_shift; unsigned int folio_shift;
unsigned long acct_pages; unsigned long acct_pages;
unsigned long folio_mask;
refcount_t refs; refcount_t refs;
struct bio_vec bvec[] __counted_by(nr_bvecs); struct bio_vec bvec[] __counted_by(nr_bvecs);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment