usched_bsd4 - use wakeup_mycpu as appropriate
authorAlex Hornung <alex@alexhornung.com>
Fri, 24 Aug 2012 06:57:43 +0000 (06:57 +0000)
committerAlex Hornung <alex@alexhornung.com>
Fri, 24 Aug 2012 07:06:09 +0000 (07:06 +0000)
 * In the need_user_resched_remote we need to use wakeup_mycpu to avoid
   sending out IPIs triggering a deep IPI recursion panic.

 * In the setrunqueue case use wakeup_mycpu as an optimization, since we
   know that we are on the same CPU as the helper thread we want to wake
   up.

In-discussion-with: Matt Dillon
Reported-by: ftigeot
sys/kern/usched_bsd4.c

index 21ffcc4..7a570cb 100644 (file)
@@ -896,7 +896,7 @@ found:
                spin_unlock(&bsd4_spin);
                if ((dd->upri & ~PPQMASK) > (lp->lwp_priority & ~PPQMASK)) {
                        if (dd->uschedcp == NULL) {
                spin_unlock(&bsd4_spin);
                if ((dd->upri & ~PPQMASK) > (lp->lwp_priority & ~PPQMASK)) {
                        if (dd->uschedcp == NULL) {
-                               wakeup(&dd->helper_thread);
+                               wakeup_mycpu(&dd->helper_thread);
                        } else {
                                need_user_resched();
                        }
                        } else {
                                need_user_resched();
                        }
@@ -1582,7 +1582,9 @@ need_user_resched_remote(void *dummy)
        bsd4_pcpu_t  dd = &bsd4_pcpu[gd->gd_cpuid];
 
        need_user_resched();
        bsd4_pcpu_t  dd = &bsd4_pcpu[gd->gd_cpuid];
 
        need_user_resched();
-       wakeup(&dd->helper_thread);
+
+       /* Call wakeup_mycpu to avoid sending IPIs to other CPUs */
+       wakeup_mycpu(&dd->helper_thread);
 }
 
 #endif
 }
 
 #endif