All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] netdevice: move xdp_rxq within netdev_rx_queue
@ 2021-08-23 18:01 Jakub Kicinski
  2021-08-23 18:38 ` Jesper Dangaard Brouer
  2021-08-24 16:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-08-23 18:01 UTC (permalink / raw)
  To: davem; +Cc: netdev, bpf, hawk, magnus.karlsson, Jakub Kicinski

Both struct netdev_rx_queue and struct xdp_rxq_info are cacheline
aligned. This causes extra padding before and after the xdp_rxq
member. Move the member upfront, so that it's naturally aligned.

Before:
	/* size: 256, cachelines: 4, members: 6 */
	/* sum members: 160, holes: 1, sum holes: 40 */
	/* padding: 56 */
	/* paddings: 1, sum paddings: 36 */
	/* forced alignments: 1, forced holes: 1, sum forced holes: 40 */

After:
	/* size: 192, cachelines: 3, members: 6 */
	/* padding: 32 */
	/* paddings: 1, sum paddings: 36 */
	/* forced alignments: 1 */

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/linux/netdevice.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9579942ac2fd..514ec3a0507c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -722,13 +722,13 @@ bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
 
 /* This structure contains an instance of an RX queue. */
 struct netdev_rx_queue {
+	struct xdp_rxq_info		xdp_rxq;
 #ifdef CONFIG_RPS
 	struct rps_map __rcu		*rps_map;
 	struct rps_dev_flow_table __rcu	*rps_flow_table;
 #endif
 	struct kobject			kobj;
 	struct net_device		*dev;
-	struct xdp_rxq_info		xdp_rxq;
 #ifdef CONFIG_XDP_SOCKETS
 	struct xsk_buff_pool            *pool;
 #endif
-- 
2.31.1


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

* Re: [PATCH net-next] netdevice: move xdp_rxq within netdev_rx_queue
  2021-08-23 18:01 [PATCH net-next] netdevice: move xdp_rxq within netdev_rx_queue Jakub Kicinski
@ 2021-08-23 18:38 ` Jesper Dangaard Brouer
  2021-08-24 16:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2021-08-23 18:38 UTC (permalink / raw)
  To: Jakub Kicinski, davem; +Cc: brouer, netdev, bpf, magnus.karlsson



On 23/08/2021 20.01, Jakub Kicinski wrote:
> Both struct netdev_rx_queue and struct xdp_rxq_info are cacheline
> aligned. This causes extra padding before and after the xdp_rxq
> member. Move the member upfront, so that it's naturally aligned.
> 
> Before:
> 	/* size: 256, cachelines: 4, members: 6 */
> 	/* sum members: 160, holes: 1, sum holes: 40 */
> 	/* padding: 56 */
> 	/* paddings: 1, sum paddings: 36 */
> 	/* forced alignments: 1, forced holes: 1, sum forced holes: 40 */
> 
> After:
> 	/* size: 192, cachelines: 3, members: 6 */
> 	/* padding: 32 */
> 	/* paddings: 1, sum paddings: 36 */
> 	/* forced alignments: 1 */
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   include/linux/netdevice.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)


LGTM

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 9579942ac2fd..514ec3a0507c 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -722,13 +722,13 @@ bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
>   
>   /* This structure contains an instance of an RX queue. */
>   struct netdev_rx_queue {
> +	struct xdp_rxq_info		xdp_rxq;
>   #ifdef CONFIG_RPS
>   	struct rps_map __rcu		*rps_map;
>   	struct rps_dev_flow_table __rcu	*rps_flow_table;
>   #endif
>   	struct kobject			kobj;
>   	struct net_device		*dev;
> -	struct xdp_rxq_info		xdp_rxq;
>   #ifdef CONFIG_XDP_SOCKETS
>   	struct xsk_buff_pool            *pool;
>   #endif
> 


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

* Re: [PATCH net-next] netdevice: move xdp_rxq within netdev_rx_queue
  2021-08-23 18:01 [PATCH net-next] netdevice: move xdp_rxq within netdev_rx_queue Jakub Kicinski
  2021-08-23 18:38 ` Jesper Dangaard Brouer
@ 2021-08-24 16:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-24 16:10 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, bpf, hawk, magnus.karlsson

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 23 Aug 2021 11:01:35 -0700 you wrote:
> Both struct netdev_rx_queue and struct xdp_rxq_info are cacheline
> aligned. This causes extra padding before and after the xdp_rxq
> member. Move the member upfront, so that it's naturally aligned.
> 
> Before:
> 	/* size: 256, cachelines: 4, members: 6 */
> 	/* sum members: 160, holes: 1, sum holes: 40 */
> 	/* padding: 56 */
> 	/* paddings: 1, sum paddings: 36 */
> 	/* forced alignments: 1, forced holes: 1, sum forced holes: 40 */
> 
> [...]

Here is the summary with links:
  - [net-next] netdevice: move xdp_rxq within netdev_rx_queue
    https://git.kernel.org/netdev/net-next/c/95d1d2490c27

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] 3+ messages in thread

end of thread, other threads:[~2021-08-24 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 18:01 [PATCH net-next] netdevice: move xdp_rxq within netdev_rx_queue Jakub Kicinski
2021-08-23 18:38 ` Jesper Dangaard Brouer
2021-08-24 16:10 ` 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.