Skip to content

Commit e209509

Browse files
Zhengyuan Liugregkh
authored andcommitted
arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
[ Upstream commit a194c5f ] The @node passed to cpumask_of_node() can be NUMA_NO_NODE, in that case it will trigger the following WARN_ON(node >= nr_node_ids) due to mismatched data types of @node and @nr_node_ids. Actually we should return cpu_all_mask just like most other architectures do if passed NUMA_NO_NODE. Also add a similar check to the inline cpumask_of_node() in numa.h. Signed-off-by: Zhengyuan Liu <liuzhengyuan@tj.kylinos.cn> Reviewed-by: Gavin Shan <gshan@redhat.com> Link: https://lore.kernel.org/r/20200921023936.21846-1-liuzhengyuan@tj.kylinos.cn Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9fa33eb commit e209509

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

arch/arm64/include/asm/numa.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ const struct cpumask *cpumask_of_node(int node);
2525
/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
2626
static inline const struct cpumask *cpumask_of_node(int node)
2727
{
28+
if (node == NUMA_NO_NODE)
29+
return cpu_all_mask;
30+
2831
return node_to_cpumask_map[node];
2932
}
3033
#endif

arch/arm64/mm/numa.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ EXPORT_SYMBOL(node_to_cpumask_map);
4646
*/
4747
const struct cpumask *cpumask_of_node(int node)
4848
{
49-
if (WARN_ON(node >= nr_node_ids))
49+
50+
if (node == NUMA_NO_NODE)
51+
return cpu_all_mask;
52+
53+
if (WARN_ON(node < 0 || node >= nr_node_ids))
5054
return cpu_none_mask;
5155

5256
if (WARN_ON(node_to_cpumask_map[node] == NULL))

0 commit comments

Comments
 (0)