svn commit: r210585 - projects/ofed/head/sys/ofed/include/linux

Jeff Roberson jeff at FreeBSD.org
Thu Jul 29 02:11:32 UTC 2010


Author: jeff
Date: Thu Jul 29 02:11:31 2010
New Revision: 210585
URL: http://svn.freebsd.org/changeset/base/210585

Log:
   - Fix the completion macros so they don't drop the queue spinlock twice.
   - Define sched_yield as sched_relinquish
   - Don't yield while cold.
  
  Sponsored by:	Isilon Systems, iX Systems, and Panasas.

Modified:
  projects/ofed/head/sys/ofed/include/linux/completion.h
  projects/ofed/head/sys/ofed/include/linux/sched.h

Modified: projects/ofed/head/sys/ofed/include/linux/completion.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/completion.h	Thu Jul 29 02:10:19 2010	(r210584)
+++ projects/ofed/head/sys/ofed/include/linux/completion.h	Thu Jul 29 02:11:31 2010	(r210585)
@@ -74,10 +74,8 @@ _wait_for_common(struct completion *c, i
 	flags |= SLEEPQ_SLEEP;
 	for (;;) {
 		sleepq_lock(c);
-		if (c->done) {
-			sleepq_release(c);
+		if (c->done)
 			break;
-		}
 		sleepq_add(c, NULL, "completion", flags, 0);
 		if (flags & SLEEPQ_INTERRUPTIBLE) {
 			if (sleepq_wait_sig(c, 0) != 0)
@@ -104,10 +102,8 @@ _wait_for_timeout_common(struct completi
 	flags |= SLEEPQ_SLEEP;
 	for (;;) {
 		sleepq_lock(c);
-		if (c->done) {
-			sleepq_release(c);
+		if (c->done)
 			break;
-		}
 		sleepq_add(c, NULL, "completion", flags, 0);
 		sleepq_set_timeout(c, end - ticks);
 		if (flags & SLEEPQ_INTERRUPTIBLE) {

Modified: projects/ofed/head/sys/ofed/include/linux/sched.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/sched.h	Thu Jul 29 02:10:19 2010	(r210584)
+++ projects/ofed/head/sys/ofed/include/linux/sched.h	Thu Jul 29 02:11:31 2010	(r210585)
@@ -74,6 +74,8 @@ struct task_struct {
 do {									\
 	void *c;							\
 									\
+	if (cold)							\
+		break;							\
 	c = curthread;							\
 	sleepq_lock(c);							\
 	if (current->state == TASK_INTERRUPTIBLE ||			\
@@ -100,6 +102,8 @@ do {									\
 		kick_proc0();						\
 } while (0)
 
-#define	cond_resched()	sched_relinquish(curthread)
+#define	cond_resched()	if (!cold)	sched_relinquish(curthread)
+
+#define	sched_yield()	sched_relinquish(curthread)
 
 #endif	/* _LINUX_SCHED_H_ */


More information about the svn-src-projects mailing list