#include <sys/thread2.h>
#include <sys/spinlock2.h>
+#include <sys/mplock2.h>
#define MAXPRI 128
#define PRIBASE_REALTIME 0
/*
* If this cpu has no current thread, select ourself
*/
- if (dd->uschedcp == NULL && TAILQ_EMPTY(&dummy_runq)) {
+ if (dd->uschedcp == lp ||
+ (dd->uschedcp == NULL && TAILQ_EMPTY(&dummy_runq))) {
atomic_set_int(&dummy_curprocmask, gd->gd_cpumask);
dd->uschedcp = lp;
return;
{
}
+/*
+ * MPSAFE
+ */
static
void
dummy_yield(struct lwp *lp)
* is possible to deschedule an LWKT thread and then do some work before
* switching away. The thread can be rescheduled at any time, even before
* we switch away.
+ *
+ * MPSAFE
*/
#ifdef SMP
dd = &dummy_pcpu[cpuid];
cpumask = 1 << cpuid;
- /*
- * Our Scheduler helper thread does not need to hold the MP lock
- */
- rel_mplock();
-
for (;;) {
lwkt_deschedule_self(gd->gd_curthread); /* interlock */
atomic_set_int(&dummy_rdyprocmask, cpumask);
kprintf(" %d", i);
lwkt_create(dummy_sched_thread, NULL, NULL, &dd->helper_thread,
- TDF_STOPREQ, i, "dsched %d", i);
+ TDF_STOPREQ | TDF_MPSAFE, i, "dsched %d", i);
/*
* Allow user scheduling on the target cpu. cpu #0 has already