Skip to content

Commit ab31c7f

Browse files
yhuang-intelingomolnar
authored andcommitted
sched/numa: Fix boot crash on arm64 systems
Qian Cai reported a boot crash on arm64 systems, caused by: 0fb3978 ("sched/numa: Fix NUMA topology for systems with CPU-less nodes") The bug is that node_state() must be supplied a valid node_states[] array index, but in task_numa_placement() the max_nid search can fail with NUMA_NO_NODE, which is not a valid index. Fix it by checking that max_nid is a valid index. [ mingo: Added changelog. ] Fixes: 0fb3978 ("sched/numa: Fix NUMA topology for systems with CPU-less nodes") Reported-by: Qian Cai <quic_qiancai@quicinc.com> Tested-by: Qian Cai <quic_qiancai@quicinc.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: "Huang, Ying" <ying.huang@intel.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 3387ce4 commit ab31c7f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/sched/fair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@ static void task_numa_placement(struct task_struct *p)
24372437
}
24382438

24392439
/* Cannot migrate task to CPU-less node */
2440-
if (!node_state(max_nid, N_CPU)) {
2440+
if (max_nid != NUMA_NO_NODE && !node_state(max_nid, N_CPU)) {
24412441
int near_nid = max_nid;
24422442
int distance, near_distance = INT_MAX;
24432443

0 commit comments

Comments
 (0)