diff mbox series

[V6,02/12] block: define 'struct bvec_iter' as packed

Message ID 20210422122038.2192933-3-ming.lei@redhat.com (mailing list archive)
State New, archived
Headers show
Series block: support bio based io polling | expand

Commit Message

Ming Lei April 22, 2021, 12:20 p.m. UTC
'struct bvec_iter' is embedded into 'struct bio', define it as packed
so that we can get one extra 4bytes for other uses without expanding
bio.

'struct bvec_iter' is often allocated on stack, so making it packed
doesn't affect performance. Also I have run io_uring on both
nvme/null_blk, and not observe performance effect in this way.

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 include/linux/bvec.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hannes Reinecke April 22, 2021, 1:18 p.m. UTC | #1
On 4/22/21 2:20 PM, Ming Lei wrote:
> 'struct bvec_iter' is embedded into 'struct bio', define it as packed
> so that we can get one extra 4bytes for other uses without expanding
> bio.
> 
> 'struct bvec_iter' is often allocated on stack, so making it packed
> doesn't affect performance. Also I have run io_uring on both
> nvme/null_blk, and not observe performance effect in this way.
> 
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>   include/linux/bvec.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/bvec.h b/include/linux/bvec.h
> index ff832e698efb..a0c4f41dfc83 100644
> --- a/include/linux/bvec.h
> +++ b/include/linux/bvec.h
> @@ -43,7 +43,7 @@ struct bvec_iter {
>   
>   	unsigned int            bi_bvec_done;	/* number of bytes completed in
>   						   current bvec */
> -};
> +} __packed;
>   
>   struct bvec_iter_all {
>   	struct bio_vec	bv;
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index ff832e698efb..a0c4f41dfc83 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -43,7 +43,7 @@  struct bvec_iter {
 
 	unsigned int            bi_bvec_done;	/* number of bytes completed in
 						   current bvec */
-};
+} __packed;
 
 struct bvec_iter_all {
 	struct bio_vec	bv;