void schedule_init(void) { spin_lock(&sched_lock); /* init provisioning stuff */ all_pcores = kmalloc(sizeof(struct sched_pcore) * num_cores, 0); memset(all_pcores, 0, sizeof(struct sched_pcore) * num_cores); assert(!core_id()); /* want the alarm on core0 for now */ init_awaiter(&ksched_waiter, __ksched_tick); set_ksched_alarm(); /* init the idlecore list. if they turned off hyperthreading, give them the * odds from 1..max-1. otherwise, give them everything by 0 (default mgmt * core). TODO: (CG/LL) better LL/CG mgmt */ #ifndef CONFIG_DISABLE_SMT for (int i = 1; i < num_cores; i++) TAILQ_INSERT_TAIL(&idlecores, pcoreid2spc(i), alloc_next); #else assert(!(num_cores % 2)); for (int i = 1; i < num_cores; i += 2) TAILQ_INSERT_TAIL(&idlecores, pcoreid2spc(i), alloc_next); #endif /* CONFIG_DISABLE_SMT */ spin_unlock(&sched_lock); #ifdef CONFIG_ARSC_SERVER int arsc_coreid = get_any_idle_core(); assert(arsc_coreid >= 0); send_kernel_message(arsc_coreid, arsc_server, 0, 0, 0, KMSG_ROUTINE); printk("Using core %d for the ARSC server\n", arsc_coreid); #endif /* CONFIG_ARSC_SERVER */ }
void schedule_init(void) { spin_lock(&sched_lock); /* init provisioning stuff */ all_pcores = kmalloc(sizeof(struct sched_pcore) * num_cpus, 0); memset(all_pcores, 0, sizeof(struct sched_pcore) * num_cpus); assert(!core_id()); /* want the alarm on core0 for now */ init_awaiter(&ksched_waiter, __kalarm); set_ksched_alarm(); /* init the idlecore list. if they turned off hyperthreading, give them the * odds from 1..max-1. otherwise, give them everything by 0 (default mgmt * core). TODO: (CG/LL) better LL/CG mgmt */ #ifndef CONFIG_DISABLE_SMT for (int i = 1; i < num_cpus; i++) TAILQ_INSERT_TAIL(&idlecores, pcoreid2spc(i), alloc_next); #else assert(!(num_cpus % 2)); for (int i = 1; i < num_cpus; i += 2) TAILQ_INSERT_TAIL(&idlecores, pcoreid2spc(i), alloc_next); #endif /* CONFIG_DISABLE_SMT */ #ifdef CONFIG_ARSC_SERVER struct sched_pcore *a_core = TAILQ_FIRST(&idlecores); assert(a_core); TAILQ_REMOVE(&idlecores, a_core, alloc_next); send_kernel_message(spc2pcoreid(a_core), arsc_server, 0, 0, 0, KMSG_ROUTINE); warn("Using core %d for the ARSCs - there are probably issues with this.", spc2pcoreid(a_core)); #endif /* CONFIG_ARSC_SERVER */ spin_unlock(&sched_lock); return; }