iokernel: don't assume core 0 is available
static unsigned int nr_avail_cores;
static unsigned int total_cores;
+static DEFINE_BITMAP(online_cores, NCPU);
DEFINE_BITMAP(avail_cores, NCPU);
struct core_assignments core_assign;
@@ -102,6 +103,7 @@ static inline void core_cede(unsigned int core)
static inline void core_init(unsigned int core)
{
bitmap_set(avail_cores, core);
+ bitmap_set(online_cores, core);
nr_avail_cores++;
total_cores++;
core_history[core].current = NULL;
@@ -656,7 +658,7 @@ void cores_init_proc(struct proc *p)
/* init core to 0 - this will result in incorrect cache locality
* decisions at first but saves us from always checking if this thread
* has run yet */
- p->threads[i].core = 0;
+ p->threads[i].core = bitmap_find_next_set(online_cores, NCPU, 0);
list_add_tail(&p->idle_threads, &p->threads[i].idle_link);
}
@@ -813,6 +815,10 @@ int cores_init(void)
/* mark all cores as unavailable */
bitmap_init(avail_cores, cpu_count, false);
+ /* mark all cores as offline */
+ bitmap_init(online_cores, cpu_count, false);
+
+
/* find cores on socket 0 that are not already in use */
for (i = 0; i < cpu_count; i++) {
if (i == core_assign.linux_core ||
