lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 19 Jun 2013 23:20:32 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	David Miller <davem@...emloft.net>
CC:	<netdev@...r.kernel.org>, <linux-net-drivers@...arflare.com>
Subject: [PATCH net-next 09/11] sfc: Prefetch RX skb header area

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@...arflare.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);
+			prefetch(skb_shinfo(skb));
+		}
 	}
 	rx_queue->skb_cache_next_unused = 0;
 }


-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ