Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2004 20:48:59 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 63010 for review
Message-ID:  <200410112048.i9BKmx0Q092120@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=63010

Change 63010 by jhb@jhb_twclab on 2004/10/11 20:48:34

	- Remove superflous nothing comments.
	- Use cpu_spinwait() in the rendezvous spins.
	- Correct the counter indices for the second and third spins.

Affected files ...

.. //depot/projects/smpng/sys/kern/subr_smp.c#38 edit

Differences ...

==== //depot/projects/smpng/sys/kern/subr_smp.c#38 (text+ko) ====

@@ -284,7 +284,6 @@
 
 	/* wait for each to clear its bit */
 	while ((stopped_cpus & map) != 0)
-		/* nothing */
 		cpu_spinwait();
 
 	return 1;
@@ -306,21 +305,26 @@
 	/* Ensure we have up-to-date values. */
 	atomic_add_acq_int(&smp_rv_waiters[0], 1);
 	while (smp_rv_waiters[0] < mp_ncpus)
-		;	/* nothing */
+		cpu_spinwait();
+
 	/* setup function */
 	if (smp_rv_setup_func != NULL)
 		smp_rv_setup_func(smp_rv_func_arg);
+
 	/* spin on entry rendezvous */
 	atomic_add_int(&smp_rv_waiters[1], 1);
-	while (smp_rv_waiters[0] < mp_ncpus)
-		;	/* nothing */
+	while (smp_rv_waiters[1] < mp_ncpus)
+		cpu_spinwait();
+
 	/* action function */
 	if (smp_rv_action_func != NULL)
 		smp_rv_action_func(smp_rv_func_arg);
+
 	/* spin on exit rendezvous */
 	atomic_add_int(&smp_rv_waiters[2], 1);
-	while (smp_rv_waiters[1] < mp_ncpus)
-		;	/* nothing */
+	while (smp_rv_waiters[2] < mp_ncpus)
+		cpu_spinwait();
+
 	/* teardown function */
 	if (smp_rv_teardown_func != NULL)
 		smp_rv_teardown_func(smp_rv_func_arg);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410112048.i9BKmx0Q092120>