From 9c99cb336b475c5531fb726194c7f03049740570 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 21 Feb 2013 15:32:12 -0800 Subject: [PATCH] kernel - Add critical section in lwkt_yield_quick() * Add a critical section to protect the clearing of the LWKT reschedule bit against gd_tdrunq. --- sys/kern/lwkt_thread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/lwkt_thread.c b/sys/kern/lwkt_thread.c index b7979a0171..27fd4d775c 100644 --- a/sys/kern/lwkt_thread.c +++ b/sys/kern/lwkt_thread.c @@ -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(); } } -- 2.41.0