Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: Re: [PATCH net-next 09/11] sfc: Prefetch RX skb header area
Date: Wed, 19 Jun 2013 15:36:29 -0700	[thread overview]
Message-ID: <1371681389.3252.339.camel@edumazet-glaptop> (raw)
In-Reply-To: <1371680432.1956.116.camel@bwh-desktop.uk.level5networks.com>

On Wed, 2013-06-19 at 23:20 +0100, Ben Hutchings wrote:
> When we pre-allocate skbs, the sk_buff structures themselves will be
> cache-hot (having just been filled in) but the header area will be
> cache-cold.  The skb cache is small and we're likely to use each skb
> quite soon, so prefetch the start of the header area, where we will
> copy the headers, and the skb_shared_info structure, where we will
> store page fragments.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
>  drivers/net/ethernet/sfc/rx.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
> index a28f2fe..0dc4a80 100644
> --- a/drivers/net/ethernet/sfc/rx.c
> +++ b/drivers/net/ethernet/sfc/rx.c
> @@ -106,11 +106,17 @@ void efx_rx_config_page_split(struct efx_nic *efx)
>  
>  static void efx_refill_skb_cache(struct efx_rx_queue *rx_queue)
>  {
> +	struct sk_buff *skb;
>  	int i;
> +
>  	for (i = 0; i < SKB_CACHE_SIZE; ++i) {
> -		rx_queue->skb_cache[i] =
> -			netdev_alloc_skb(rx_queue->efx->net_dev,
> -					 EFX_SKB_HEADERS + EFX_PAGE_SKB_ALIGN);
> +		skb = netdev_alloc_skb(rx_queue->efx->net_dev,
> +				       EFX_SKB_HEADERS + EFX_PAGE_SKB_ALIGN);
> +		rx_queue->skb_cache[i] = skb;
> +		if (skb) {
> +			prefetch(skb->data);

This is really suspect.

This part will be dirtied anyway by the NIC once frame is received.

> +			prefetch(skb_shinfo(skb));
> +		}
>  	}
>  	rx_queue->skb_cache_next_unused = 0;
>  }
> 
> 

Quite frankly this cache sounds suspect to me.

Why is it needed only for sfc ?

Have you tried build_skb() instead ?

  reply	other threads:[~2013-06-19 22:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 22:16 Pull request: sfc-next 2013-06-19 Ben Hutchings
2013-06-19 22:17 ` [PATCH net-next 01/11] sfc: Fix EEH with legacy interrupts Ben Hutchings
2013-06-19 22:18 ` [PATCH net-next 02/11] sfc: Enable RX checksum offload for packets not handled by GRO Ben Hutchings
2013-06-19 22:18 ` [PATCH net-next 03/11] sfc: Increase size of RX SKB header area Ben Hutchings
2013-06-19 22:38   ` Eric Dumazet
2013-06-19 22:18 ` [PATCH net-next 04/11] sfc: Report software timestamping capabilities Ben Hutchings
2013-06-19 22:19 ` [PATCH net-next 05/11] sfc: Enable accelerated RFS on vlans Ben Hutchings
2013-06-19 22:19 ` [PATCH net-next 06/11] sfc: Define and set RX buffer flag for packets parsed as TCP Ben Hutchings
2013-06-19 22:19 ` [PATCH net-next 07/11] sfc: Do not pass non-TCP packets into GRO code Ben Hutchings
2013-06-19 22:56   ` Eric Dumazet
2013-06-19 23:18     ` Ben Hutchings
2013-06-19 22:20 ` [PATCH net-next 08/11] sfc: Implement RX SKB cache to improve latency Ben Hutchings
2013-06-19 22:20 ` [PATCH net-next 09/11] sfc: Prefetch RX skb header area Ben Hutchings
2013-06-19 22:36   ` Eric Dumazet [this message]
2013-06-19 22:39     ` Ben Hutchings
2013-06-19 22:56       ` Eric Dumazet
2013-06-19 23:10         ` Ben Hutchings
2013-06-19 22:21 ` [PATCH net-next 10/11] sfc: Fix IRQ cleanup in case of a probe failure Ben Hutchings
2013-06-19 22:21 ` [PATCH net-next 11/11] sfc: Improve test for IOMMU in use Ben Hutchings
2013-06-19 23:11 ` Pull request: sfc-next 2013-06-19 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371681389.3252.339.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox