]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/sched_dualq.c
xnu-4570.41.2.tar.gz
[apple/xnu.git] / osfmk / kern / sched_dualq.c
index f7cbccb40e672795ea08535a220e40c2c4d4f3ee..f465d803e19d11165fb4c00c188fe9ae4af9f02c 100644 (file)
@@ -126,6 +126,20 @@ const struct sched_dispatch_table sched_dualq_dispatch = {
        .direct_dispatch_to_idle_processors             = FALSE,
        .multiple_psets_enabled                         = TRUE,
        .sched_groups_enabled                           = FALSE,
+       .avoid_processor_enabled                        = FALSE,
+       .thread_avoid_processor                         = NULL,
+       .processor_balance                              = sched_SMT_balance,
+
+       .rt_runq                                        = sched_rtglobal_runq,
+       .rt_init                                        = sched_rtglobal_init,
+       .rt_queue_shutdown                              = sched_rtglobal_queue_shutdown,
+       .rt_runq_scan                                   = sched_rtglobal_runq_scan,
+       .rt_runq_count_sum                              = sched_rtglobal_runq_count_sum,
+
+       .qos_max_parallelism                            = sched_qos_max_parallelism,
+       .check_spill                                    = sched_check_spill,
+       .ipi_policy                                     = sched_ipi_policy,
+       .thread_should_yield                            = sched_thread_should_yield,
 };
 
 __attribute__((always_inline))
@@ -268,7 +282,10 @@ sched_dualq_processor_queue_has_priority(processor_t    processor,
                                          int            priority,
                                          boolean_t      gte)
 {
-       int qpri = MAX(dualq_main_runq(processor)->highq, dualq_bound_runq(processor)->highq);
+       run_queue_t main_runq  = dualq_main_runq(processor);
+       run_queue_t bound_runq = dualq_bound_runq(processor);
+
+       int qpri = MAX(main_runq->highq, bound_runq->highq);
 
        if (gte)
                return qpri >= priority;
@@ -316,12 +333,15 @@ sched_dualq_processor_queue_shutdown(processor_t processor)
 
        while (rq->count > 0) {
                thread = run_queue_dequeue(rq, SCHED_HEADQ);
-               enqueue_tail(&tqueue, (queue_entry_t)thread);
+               enqueue_tail(&tqueue, &thread->runq_links);
        }
 
        pset_unlock(pset);
 
-       while ((thread = (thread_t)(void*)dequeue_head(&tqueue)) != THREAD_NULL) {
+       qe_foreach_element_safe(thread, &tqueue, runq_links) {
+
+               remqueue(&thread->runq_links);
+
                thread_lock(thread);
 
                thread_setrun(thread, SCHED_TAILQ);