svn commit: r193669 - user/kmacy/releng_7_2_fcs/sys/net

Kip Macy kmacy at FreeBSD.org
Sun Jun 7 23:47:07 UTC 2009


Author: kmacy
Date: Sun Jun  7 23:47:06 2009
New Revision: 193669
URL: http://svn.freebsd.org/changeset/base/193669

Log:
  pre-fetch collision entries

Modified:
  user/kmacy/releng_7_2_fcs/sys/net/flowtable.c

Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c	Sun Jun  7 23:46:29 2009	(r193668)
+++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c	Sun Jun  7 23:47:06 2009	(r193669)
@@ -177,6 +177,20 @@ static struct cv 	flowclean_cv;
 static struct mtx	flowclean_lock;
 static uint64_t		flowclean_cycles;
 
+#if defined(__i386__) || defined(__amd64__)
+static __inline
+void prefetch(void *x) 
+{ 
+        __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
+} 
+#else
+static __inline
+void prefetch(void *x) 
+{
+	;
+}
+#endif
+
 /*
  * TODO:
  * - Make flowtable stats per-cpu, aggregated at sysctl call time,
@@ -613,7 +627,10 @@ flowtable_lookup(struct flowtable *ft, s
 		FL_ENTRY_UNLOCK(ft, hash);
 		goto uncached;
 	}
-keycheck:	
+keycheck:
+	if (fle->f_next != NULL)
+		prefetch(fle->f_next);
+
 	rt = __DEVOLATILE(struct rtentry *, fle->f_rt);
 	lle = __DEVOLATILE(struct llentry *, fle->f_lle);
 	if ((rt != NULL)


More information about the svn-src-user mailing list