[PATCH] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE

Gavin Shan gshan at redhat.com
Sat Sep 19 20:09:04 EDT 2020


On 9/18/20 11:15 AM, Zhengyuan Liu wrote:
> Filter out NUMA_NO_NODE before returning cpumask of a node, otherwise
> it will triger the following WARN_ON(node >= nr_node_ids).
> 
> Signed-off-by: Zhengyuan Liu <liuzhengyuan at tj.kylinos.cn>
> ---

With two improvements as discussed:

    - Explain how the following WARN_ON() is triggered because of
      mismatched data types of @node and @nr_node_ids in change log.
    - Similar changes to cpumask_of_node() in numa.h

With these fixed:

Reviewed-by: Gavin Shan <gshan at redhat.com>

>   arch/arm64/mm/numa.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index 73f8b49d485c..78f9b7dab656 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -46,6 +46,9 @@ EXPORT_SYMBOL(node_to_cpumask_map);
>    */
>   const struct cpumask *cpumask_of_node(int node)
>   {
> +	if (node == NUMA_NO_NODE)
> +		return cpu_all_mask;
> +
>   	if (WARN_ON(node >= nr_node_ids))
>   		return cpu_none_mask;
>   
> 




More information about the linux-arm-kernel mailing list