svn commit: r198306 - head/sys/net

Qing Li qingli at FreeBSD.org
Tue Oct 20 21:27:04 UTC 2009


Author: qingli
Date: Tue Oct 20 21:27:03 2009
New Revision: 198306
URL: http://svn.freebsd.org/changeset/base/198306

Log:
  The flow-table function flowtable_route_flush() may be called
  during system initialization time. Since the flow-table is
  designed to maintain per CPU flow cache, the existing code
  did not check whether "smp_started" is true before calling
  sched_bind() and sched_unbind(), which triggers a page fault.
  
  Reviewed by:	jeff
  MFC after:	immediately

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==============================================================================
--- head/sys/net/flowtable.c	Tue Oct 20 21:08:32 2009	(r198305)
+++ head/sys/net/flowtable.c	Tue Oct 20 21:27:03 2009	(r198306)
@@ -930,16 +930,20 @@ flowtable_route_flush(struct flowtable *
 		for (i = 0; i <= mp_maxid; i++) {
 			if (CPU_ABSENT(i))
 				continue;
-
-			thread_lock(curthread);
-			sched_bind(curthread, i);
-			thread_unlock(curthread);
+			
+			if (smp_started == 1) {
+				thread_lock(curthread);
+				sched_bind(curthread, i);
+				thread_unlock(curthread);
+			}
 
 			flowtable_free_stale(ft, rt);
 
-			thread_lock(curthread);
-			sched_unbind(curthread);
-			thread_unlock(curthread);
+			if (smp_started == 1) {
+				thread_lock(curthread);
+				sched_unbind(curthread);
+				thread_unlock(curthread);
+			}
 		}
 	} else {
 		flowtable_free_stale(ft, rt);


More information about the svn-src-all mailing list