-
-#if defined(CONFIG_SCHED_GRRR)
-
-static struct grrr_run_queue fs_grrr_runq;
-#define FS_GRRR_RUNQ ((processor_t)-2)
-decl_simple_lock_data(static,fs_grrr_lock);
-
-void
-sched_grrr_fairshare_init(void)
-{
- grrr_priority_mapping_init();
-
- simple_lock_init(&fs_grrr_lock, 0);
- grrr_runqueue_init(&fs_grrr_runq);
-}
-
-
-int
-sched_grrr_fairshare_runq_count(void)
-{
- return fs_grrr_runq.count;
-}
-
-uint64_t
-sched_grrr_fairshare_runq_stats_count_sum(void)
-{
- return fs_grrr_runq.runq_stats.count_sum;
-}
-
-void
-sched_grrr_fairshare_enqueue(thread_t thread)
-{
- simple_lock(&fs_grrr_lock);
-
- (void)grrr_enqueue(&fs_grrr_runq, thread);
-
- thread->runq = FS_GRRR_RUNQ;
-
- simple_unlock(&fs_grrr_lock);
-}
-
-thread_t sched_grrr_fairshare_dequeue(void)
-{
- thread_t thread;
-
- simple_lock(&fs_grrr_lock);
- if (fs_grrr_runq.count > 0) {
- thread = grrr_select(&fs_grrr_runq);
-
- simple_unlock(&fs_grrr_lock);
-
- return (thread);
- }
- simple_unlock(&fs_grrr_lock);
-
- return THREAD_NULL;
-}
-
-boolean_t sched_grrr_fairshare_queue_remove(thread_t thread)
-{
-
- simple_lock(&fs_grrr_lock);
-
- if (FS_GRRR_RUNQ == thread->runq) {
- grrr_remove(&fs_grrr_runq, thread);
-
- simple_unlock(&fs_grrr_lock);
- return (TRUE);
- }
- else {
- /*
- * The thread left the run queue before we could
- * lock the run queue.
- */
- assert(thread->runq == PROCESSOR_NULL);
- simple_unlock(&fs_grrr_lock);
- return (FALSE);
- }
-}
-
-#endif /* defined(CONFIG_SCHED_GRRR) */