@@ -685,6 +685,8 @@ static bool io_try_coalesce_buffer(struct page ***pages, int *nr_pages,
return false;
data->folio_shift = folio_shift(folio);
+ WARN_ON_ONCE(data->folio_shift >= 64);
+
/*
* Check if pages are contiguous inside a folio, and all folios have
* the same page count except for the head and tail.
@@ -32,9 +32,9 @@ struct io_mapped_buf {
u64 addr;
unsigned int len;
unsigned int nr_bvecs;
- unsigned int folio_shift;
refcount_t refs;
- unsigned long acct_pages;
+ unsigned int acct_pages;
+ unsigned int folio_shift:6;
struct bio_vec bvec[] __counted_by(nr_bvecs);
};
@@ -43,7 +43,7 @@ struct io_imu_folio_data {
unsigned int nr_pages_head;
/* For non-head/tail folios, has to be fully included */
unsigned int nr_pages_mid;
- unsigned int folio_shift;
+ unsigned char folio_shift;
};
struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx, int type);
`struct io_mapped_buf` will be extended to cover kernel buffer which may be in fast IO path, and `struct io_mapped_buf` needs to be per-IO. So shrink sizeof(struct io_mapped_buf) by the following ways: - folio_shift is < 64, so 6bits are enough to hold it, the remained bits can be used for the coming kernel buffer - define `acct_pages` as 'unsigned int', which is big enough for accounting pages in the buffer Signed-off-by: Ming Lei <ming.lei@redhat.com> --- io_uring/rsrc.c | 2 ++ io_uring/rsrc.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-)