sched: When disabling SMT, turn off the odd cores

Previously, we were turning off the even cores, but that gave out core 1,
which was hyperthreaded with core 0.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/src/corealloc_fcfs.c b/kern/src/corealloc_fcfs.c
index af4ab7c..d250af9 100644
--- a/kern/src/corealloc_fcfs.c
+++ b/kern/src/corealloc_fcfs.c
@@ -25,18 +25,16 @@
 	/* 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 = 0; i < num_cores; i++)
-		if (!is_ll_core(i))
-			TAILQ_INSERT_TAIL(&idlecores, pcoreid2spc(i), alloc_next);
-#else
-	assert(!(num_cores % 2));
-	/* TODO: rethink starting at 1 here. If SMT is really disabled, the entire
-	 * core of an "ll" core shouldn't be available. */
-	for (int i = 1; i < num_cores; i += 2)
-		if (!is_ll_core(i))
-			TAILQ_INSERT_TAIL(&idlecores, pcoreid2spc(i), alloc_next);
+	for (int i = 0; i < num_cores; i++) {
+		if (is_ll_core(i))
+			continue;
+#ifdef CONFIG_DISABLE_SMT
+		/* Remove all odd cores from consideration for allocation. */
+		if (i % 2 == 1)
+			continue;
 #endif /* CONFIG_DISABLE_SMT */
+		TAILQ_INSERT_TAIL(&idlecores, pcoreid2spc(i), alloc_next);
+	}
 }
 
 /* Initialize any data associated with allocating cores to a process. */
diff --git a/kern/src/corealloc_packed.c b/kern/src/corealloc_packed.c
index 32b2e95..bd1957d 100644
--- a/kern/src/corealloc_packed.c
+++ b/kern/src/corealloc_packed.c
@@ -190,8 +190,8 @@
 			continue;
 		}
 #ifdef CONFIG_DISABLE_SMT
-		/* Remove all even cores from consideration for allocation. */
-		if (i % 2 == 0) {
+		/* Remove all odd cores from consideration for allocation. */
+		if (i % 2 == 1) {
 			incref_nodes(all_pcores[i].sched_pnode);
 			continue;
 		}