diff mbox series

[net-next] virtio-net: Reduce debug name field size to 16 bytes

Message ID 20230123035511.1122358-1-parav@nvidia.com (mailing list archive)
State Accepted
Commit d0671115869d19ec76d658c4bf86d3211a8ea121
Delegated to: Netdev Maintainers
Headers show
Series [net-next] virtio-net: Reduce debug name field size to 16 bytes | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Parav Pandit Jan. 23, 2023, 3:55 a.m. UTC
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(-)

Comments

Pavan Chebbi Jan. 23, 2023, 2:12 p.m. UTC | #1
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>
patchwork-bot+netdevbpf@kernel.org Jan. 25, 2023, 9:30 a.m. UTC | #2
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!
diff mbox series

Patch

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;
 };