Skip to content

Commit

Permalink
sched/numa: Fix boot crash on arm64 systems
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Qian Cai <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Linus Torvalds <[email protected]>
Signed-off-by: "Huang, Ying" <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
yhuang-intel authored and Ingo Molnar committed Mar 22, 2022
1 parent 3387ce4 commit ab31c7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,7 @@ static void task_numa_placement(struct task_struct *p)
}

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

Expand Down

0 comments on commit ab31c7f

Please sign in to comment.