All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] virtio-net: Reduce debug name field size to 16 bytes
@ 2023-01-23  3:55 ` Parav Pandit
  0 siblings, 0 replies; 4+ messages in thread
From: Parav Pandit via Virtualization @ 2023-01-23  3:55 UTC (permalink / raw)
  To: mst, jasowang, netdev, davem, kuba; +Cc: edumazet, pabeni, virtualization

virtio queue index can be maximum of 65535. 16 bytes are enough to store
the vq name with the existing string prefix.

With this change, send queue struct saves 24 bytes and receive
queue saves whole cache line worth 64 bytes per structure
due to saving in alignment bytes.

Pahole results before:

pahole -s drivers/net/virtio_net.o | \
    grep -e "send_queue" -e "receive_queue"
send_queue      1112    0
receive_queue   1280    1

Pahole results after:
pahole -s drivers/net/virtio_net.o | \
    grep -e "send_queue" -e "receive_queue"
send_queue      1088    0
receive_queue   1216    1

Signed-off-by: Parav Pandit <parav@nvidia.com>
---
 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a170b0075dcf..3855b8524300 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -134,7 +134,7 @@ struct send_queue {
 	struct scatterlist sg[MAX_SKB_FRAGS + 2];
 
 	/* Name of the send queue: output.$index */
-	char name[40];
+	char name[16];
 
 	struct virtnet_sq_stats stats;
 
@@ -171,7 +171,7 @@ struct receive_queue {
 	unsigned int min_buf_len;
 
 	/* Name of this receive queue: input.$index */
-	char name[40];
+	char name[16];
 
 	struct xdp_rxq_info xdp_rxq;
 };
-- 
2.26.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next] virtio-net: Reduce debug name field size to 16 bytes
@ 2023-01-23  3:55 ` Parav Pandit
  0 siblings, 0 replies; 4+ messages in thread
From: Parav Pandit @ 2023-01-23  3:55 UTC (permalink / raw)
  To: mst, jasowang, netdev, davem, kuba
  Cc: edumazet, pabeni, virtualization, Parav Pandit

virtio queue index can be maximum of 65535. 16 bytes are enough to store
the vq name with the existing string prefix.

With this change, send queue struct saves 24 bytes and receive
queue saves whole cache line worth 64 bytes per structure
due to saving in alignment bytes.

Pahole results before:

pahole -s drivers/net/virtio_net.o | \
    grep -e "send_queue" -e "receive_queue"
send_queue      1112    0
receive_queue   1280    1

Pahole results after:
pahole -s drivers/net/virtio_net.o | \
    grep -e "send_queue" -e "receive_queue"
send_queue      1088    0
receive_queue   1216    1

Signed-off-by: Parav Pandit <parav@nvidia.com>
---
 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a170b0075dcf..3855b8524300 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -134,7 +134,7 @@ struct send_queue {
 	struct scatterlist sg[MAX_SKB_FRAGS + 2];
 
 	/* Name of the send queue: output.$index */
-	char name[40];
+	char name[16];
 
 	struct virtnet_sq_stats stats;
 
@@ -171,7 +171,7 @@ struct receive_queue {
 	unsigned int min_buf_len;
 
 	/* Name of this receive queue: input.$index */
-	char name[40];
+	char name[16];
 
 	struct xdp_rxq_info xdp_rxq;
 };
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] virtio-net: Reduce debug name field size to 16 bytes
  2023-01-23  3:55 ` Parav Pandit
  (?)
@ 2023-01-23 14:12 ` Pavan Chebbi
  -1 siblings, 0 replies; 4+ messages in thread
From: Pavan Chebbi @ 2023-01-23 14:12 UTC (permalink / raw)
  To: Parav Pandit
  Cc: mst, jasowang, netdev, davem, kuba, edumazet, pabeni, virtualization

[-- Attachment #1: Type: text/plain, Size: 1592 bytes --]

On Mon, Jan 23, 2023 at 9:25 AM Parav Pandit <parav@nvidia.com> wrote:
>
> virtio queue index can be maximum of 65535. 16 bytes are enough to store
> the vq name with the existing string prefix.
>
> With this change, send queue struct saves 24 bytes and receive
> queue saves whole cache line worth 64 bytes per structure
> due to saving in alignment bytes.
>
> Pahole results before:
>
> pahole -s drivers/net/virtio_net.o | \
>     grep -e "send_queue" -e "receive_queue"
> send_queue      1112    0
> receive_queue   1280    1
>
> Pahole results after:
> pahole -s drivers/net/virtio_net.o | \
>     grep -e "send_queue" -e "receive_queue"
> send_queue      1088    0
> receive_queue   1216    1
>
> Signed-off-by: Parav Pandit <parav@nvidia.com>
> ---
>  drivers/net/virtio_net.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index a170b0075dcf..3855b8524300 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -134,7 +134,7 @@ struct send_queue {
>         struct scatterlist sg[MAX_SKB_FRAGS + 2];
>
>         /* Name of the send queue: output.$index */
> -       char name[40];
> +       char name[16];
>
>         struct virtnet_sq_stats stats;
>
> @@ -171,7 +171,7 @@ struct receive_queue {
>         unsigned int min_buf_len;
>
>         /* Name of this receive queue: input.$index */
> -       char name[40];
> +       char name[16];
>
>         struct xdp_rxq_info xdp_rxq;
>  };
> --
> 2.26.2
>

Looks good to me.
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] virtio-net: Reduce debug name field size to 16 bytes
  2023-01-23  3:55 ` Parav Pandit
  (?)
  (?)
@ 2023-01-25  9:30 ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-25  9:30 UTC (permalink / raw)
  To: Parav Pandit
  Cc: mst, jasowang, netdev, davem, kuba, edumazet, pabeni, virtualization

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 23 Jan 2023 05:55:11 +0200 you wrote:
> virtio queue index can be maximum of 65535. 16 bytes are enough to store
> the vq name with the existing string prefix.
> 
> With this change, send queue struct saves 24 bytes and receive
> queue saves whole cache line worth 64 bytes per structure
> due to saving in alignment bytes.
> 
> [...]

Here is the summary with links:
  - [net-next] virtio-net: Reduce debug name field size to 16 bytes
    https://git.kernel.org/netdev/net-next/c/d0671115869d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-25  9:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23  3:55 [PATCH net-next] virtio-net: Reduce debug name field size to 16 bytes Parav Pandit via Virtualization
2023-01-23  3:55 ` Parav Pandit
2023-01-23 14:12 ` Pavan Chebbi
2023-01-25  9:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.