kernel - Add critical section in lwkt_yield_quick()
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Feb 2013 23:32:12 +0000 (15:32 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Feb 2013 23:32:12 +0000 (15:32 -0800)
* Add a critical section to protect the clearing of the LWKT reschedule
  bit against gd_tdrunq.

sys/kern/lwkt_thread.c

index b7979a0..27fd4d7 100644 (file)
@@ -1178,12 +1178,14 @@ lwkt_yield_quick(void)
     if ((gd->gd_reqflags & RQF_IDLECHECK_MASK) && td->td_nest_count < 2)
        splz();
     if (lwkt_resched_wanted()) {
+       crit_enter();
        if (TAILQ_FIRST(&gd->gd_tdrunq) == td) {
            clear_lwkt_resched();
        } else {
            lwkt_schedule_self(curthread);
            lwkt_switch();
        }
+       crit_exit();
     }
 }