Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jul 2010 02:11:31 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r210585 - projects/ofed/head/sys/ofed/include/linux
Message-ID:  <201007290211.o6T2BVav099111@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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_ */



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