diff mbox series

[2/4] RDMA/siw: Reduce memory usage of struct siw_rx_stream

Message ID 20231129032418.26705-3-guoqing.jiang@linux.dev (mailing list archive)
State Superseded
Headers show
Series Misc changes for siw | expand

Commit Message

Guoqing Jiang Nov. 29, 2023, 3:24 a.m. UTC
We can reduce the memory of the struct by move some of it's
member.

Before,

	/* size: 144, cachelines: 3, members: 17 */
	/* sum members: 124, holes: 3, sum holes: 12 */
	/* sum bitfield members: 7 bits (0 bytes) */
	/* padding: 7 */
	/* bit_padding: 1 bits */

After

	/* size: 128, cachelines: 2, members: 17 */
	/* padding: 3 */
	/* bit_padding: 1 bits */

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/infiniband/sw/siw/siw.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bernard Metzler Dec. 1, 2023, 3:43 p.m. UTC | #1
> -----Original Message-----
> From: Guoqing Jiang <guoqing.jiang@linux.dev>
> Sent: Wednesday, November 29, 2023 4:24 AM
> To: Bernard Metzler <BMT@zurich.ibm.com>; jgg@ziepe.ca; leon@kernel.org
> Cc: linux-rdma@vger.kernel.org; guoqing.jiang@linux.dev
> Subject: [EXTERNAL] [PATCH 2/4] RDMA/siw: Reduce memory usage of struct
> siw_rx_stream
> 
> We can reduce the memory of the struct by move some of it's
> member.
> 
> Before,
> 
> 	/* size: 144, cachelines: 3, members: 17 */
> 	/* sum members: 124, holes: 3, sum holes: 12 */
> 	/* sum bitfield members: 7 bits (0 bytes) */
> 	/* padding: 7 */
> 	/* bit_padding: 1 bits */
> 
> After
> 
> 	/* size: 128, cachelines: 2, members: 17 */
> 	/* padding: 3 */
> 	/* bit_padding: 1 bits */
> 
> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
> ---
>  drivers/infiniband/sw/siw/siw.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw.h
> b/drivers/infiniband/sw/siw/siw.h
> index d14bb965af75..2edba2a864bb 100644
> --- a/drivers/infiniband/sw/siw/siw.h
> +++ b/drivers/infiniband/sw/siw/siw.h
> @@ -288,10 +288,11 @@ struct siw_rx_stream {
>  	int skb_offset; /* offset in skb */
>  	int skb_copied; /* processed bytes in skb */
> 
> +	enum siw_rx_state state;
> +
>  	union iwarp_hdr hdr;
>  	struct mpa_trailer trailer;
> -
> -	enum siw_rx_state state;
> +	struct shash_desc *mpa_crc_hd;
> 
>  	/*
>  	 * For each FPDU, main RX loop runs through 3 stages:
> @@ -313,7 +314,6 @@ struct siw_rx_stream {
>  	u64 ddp_to;
>  	u32 inval_stag; /* Stag to be invalidated */
> 
> -	struct shash_desc *mpa_crc_hd;
>  	u8 rx_suspend : 1;
>  	u8 pad : 2; /* # of pad bytes expected */
>  	u8 rdmap_op : 4; /* opcode of current frame */
> --
> 2.35.3

Looks good.

Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h
index d14bb965af75..2edba2a864bb 100644
--- a/drivers/infiniband/sw/siw/siw.h
+++ b/drivers/infiniband/sw/siw/siw.h
@@ -288,10 +288,11 @@  struct siw_rx_stream {
 	int skb_offset; /* offset in skb */
 	int skb_copied; /* processed bytes in skb */
 
+	enum siw_rx_state state;
+
 	union iwarp_hdr hdr;
 	struct mpa_trailer trailer;
-
-	enum siw_rx_state state;
+	struct shash_desc *mpa_crc_hd;
 
 	/*
 	 * For each FPDU, main RX loop runs through 3 stages:
@@ -313,7 +314,6 @@  struct siw_rx_stream {
 	u64 ddp_to;
 	u32 inval_stag; /* Stag to be invalidated */
 
-	struct shash_desc *mpa_crc_hd;
 	u8 rx_suspend : 1;
 	u8 pad : 2; /* # of pad bytes expected */
 	u8 rdmap_op : 4; /* opcode of current frame */