sched: Fix packed initialization Setting alloc_proc = -1 blows up a few things, at least prov -s. There's probably other / future issues with it. The new way a lot clearer too - one pass, make our decision, and move on. Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/src/corealloc_packed.c b/kern/src/corealloc_packed.c index 9490257..32b2e95 100644 --- a/kern/src/corealloc_packed.c +++ b/kern/src/corealloc_packed.c
@@ -12,7 +12,6 @@ enum pnode_type { CORE, CPU, SOCKET, NUMA, MACHINE, NUM_NODE_TYPES }; static char pnode_label[5][8] = { "CORE", "CPU", "SOCKET", "NUMA", "MACHINE" }; -#define UNNAMED_PROC ((void*)-1) /* Internal representation of a node in the hierarchy of elements in the cpu * topology of the machine (i.e. numa domain, socket, cpu, core, etc.). */ @@ -184,26 +183,22 @@ /* Initialize our table of core_distances */ init_core_distances(); - /* Remove all ll_cores from consideration for allocation. */ - for (int i = 0; i < num_cores; i++) + for (int i = 0; i < num_cores; i++) { + /* Remove all ll_cores from consideration for allocation. */ if (is_ll_core(i)) { - all_pcores[i].alloc_proc = UNNAMED_PROC; incref_nodes(all_pcores[i].sched_pnode); + continue; } - #ifdef CONFIG_DISABLE_SMT - /* Remove all even cores from consideration for allocation. */ - assert(!(num_cores % 2)); - for (int i = 0; i < num_cores; i += 2) { - all_pcores[i].alloc_proc = UNNAMED_PROC; - incref_nodes(all_pcores[i].sched_pnode); - } + /* Remove all even cores from consideration for allocation. */ + if (i % 2 == 0) { + incref_nodes(all_pcores[i].sched_pnode); + continue; + } #endif /* CONFIG_DISABLE_SMT */ - - /* Fill the idlecores array. */ - for (int i = 0; i < num_cores; i++) - if (all_pcores[i].alloc_proc != UNNAMED_PROC) - TAILQ_INSERT_HEAD(&idlecores, &all_pcores[i], alloc_next); + /* Fill the idlecores array. */ + TAILQ_INSERT_HEAD(&idlecores, &all_pcores[i], alloc_next); + } } /* Initialize any data associated with allocating cores to a process. */