svn commit: r191643 - in head/sys: kern sys
Kostik Belousov
kostikbel at gmail.com
Wed Apr 29 16:54:27 UTC 2009
On Wed, Apr 29, 2009 at 03:15:44AM +0000, Jeff Roberson wrote:
> Author: jeff
> Date: Wed Apr 29 03:15:43 2009
> New Revision: 191643
> URL: http://svn.freebsd.org/changeset/base/191643
>
> Log:
> - Remove the bogus idle thread state code. This may have a race in it
> and it only optimized out an ipi or mwait in very few cases.
> - Skip the adaptive idle code when running on SMT or HTT cores. This
> just wastes cpu time that could be used on a busy thread on the same
> core.
> - Rename CG_FLAG_THREAD to CG_FLAG_SMT to be more descriptive. Re-use
> CG_FLAG_THREAD to mean SMT or HTT.
>
> Sponsored by: Nokia
>
> Modified:
> head/sys/kern/sched_ule.c
> head/sys/kern/subr_smp.c
> head/sys/sys/smp.h
Now I see a reason why it is better #ifdef SMP the code that uses CG_FLAG_*.
Also, we should check for tdq_cg != NULL in one more place.
See the patch below, instead of exposing CG_FLAG_* for !SMP configs.
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 680572d..fe3a119 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -891,6 +891,7 @@ tdq_move(struct tdq *from, struct tdq *to)
return (1);
}
+#ifdef SMP
/*
* This tdq has idled. Try to steal a thread from another cpu and switch
* to it.
@@ -947,6 +948,7 @@ tdq_idled(struct tdq *tdq)
spinlock_exit();
return (1);
}
+#endif
/*
* Notify a remote cpu of new work. Sends an IPI if criteria are met.
@@ -2525,7 +2527,9 @@ sched_idletd(void *dummy)
struct thread *td;
struct tdq *tdq;
int switchcnt;
+#ifdef SMP
int i;
+#endif
mtx_assert(&Giant, MA_NOTOWNED);
td = curthread;
@@ -2543,7 +2547,9 @@ sched_idletd(void *dummy)
* loops while on SMT machines as this simply steals
* cycles from cores doing useful work.
*/
- if ((tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
+#ifdef SMP
+ if (tdq->tdq_cg != NULL &&
+ (tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
switchcnt > sched_idlespinthresh) {
for (i = 0; i < sched_idlespins; i++) {
if (tdq->tdq_load)
@@ -2551,6 +2557,7 @@ sched_idletd(void *dummy)
cpu_spinwait();
}
}
+#endif
switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
if (tdq->tdq_load == 0)
cpu_idle(switchcnt > 1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090429/31495e52/attachment.pgp
More information about the svn-src-all
mailing list