Skip to content

Commit

Permalink
sched/topology: Fix sched_numa_find_nth_cpu() in non-NUMA case
Browse files Browse the repository at this point in the history
When CONFIG_NUMA is enabled, sched_numa_find_nth_cpu() searches for a
CPU in sched_domains_numa_masks. The masks includes only online CPUs,
so effectively offline CPUs are skipped.

When CONFIG_NUMA is disabled, the fallback function should be consistent.

Fixes: cd7f553 ("sched: add sched_numa_find_nth_cpu()")
Signed-off-by: Yury Norov <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Cc: Mel Gorman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
YuryNorov authored and Ingo Molnar committed Sep 15, 2023
1 parent 617f2c3 commit 8ab63d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ extern const struct cpumask *sched_numa_hop_mask(unsigned int node, unsigned int
#else
static __always_inline int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node)
{
return cpumask_nth(cpu, cpus);
return cpumask_nth_and(cpu, cpus, cpu_online_mask);
}

static inline const struct cpumask *
Expand Down

0 comments on commit 8ab63d4

Please sign in to comment.