2022-02-10 05:51:20

by Ming Lei

[permalink] [raw]
Subject: Re: [PATCH v3] irq: consider cpus on nodes are unbalanced

On Thu, Feb 10, 2022 at 12:10:53PM +0900, Rei Yamamoto wrote:
> If cpus on a node are offline at boot time, there are
> difference in the number of nodes between when building affinity
> masks for present cpus and when building affinity masks for possible
> cpus. This patch fixes a problem caused by the difference of the
> number of nodes:
>
> - The routine of "numvecs <= nodes" condition can overwrite bits of
> masks for present cpus in building masks for possible cpus. Fix this
> problem by making CPU bits, which is not target, not changing.
>
> Signed-off-by: Rei Yamamoto <[email protected]>
> Reviewed-by: Ming Lei <[email protected]>
> ---
> kernel/irq/affinity.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
> index f7ff8919dc9b..d2d01565d2ec 100644
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -269,8 +269,9 @@ static int __irq_build_affinity_masks(unsigned int startvec,
> */
> if (numvecs <= nodes) {
> for_each_node_mask(n, nodemsk) {
> + cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]);
> cpumask_or(&masks[curvec].mask, &masks[curvec].mask,
> - node_to_cpumask[n]);
> + nmsk);
> if (++curvec == last_affv)
> curvec = firstvec;
> }
> --
> 2.27.0
>

--
Ming



2022-03-31 04:43:41

by Rei Yamamoto

[permalink] [raw]
Subject: Re: [PATCH v3] irq: consider cpus on nodes are unbalanced

On Thu, Feb 10, 2022 at 12:10:18PM +0800, Ming Lei wrote:
> On Thu, Feb 10, 2022 at 12:10:53PM +0900, Rei Yamamoto wrote:
>> If cpus on a node are offline at boot time, there are
>> difference in the number of nodes between when building affinity
>> masks for present cpus and when building affinity masks for possible
>> cpus. This patch fixes a problem caused by the difference of the
>> number of nodes:
>>
>> - The routine of "numvecs <= nodes" condition can overwrite bits of
>> masks for present cpus in building masks for possible cpus. Fix this
>> problem by making CPU bits, which is not target, not changing.
>>
>> Signed-off-by: Rei Yamamoto <[email protected]>
>> Reviewed-by: Ming Lei <[email protected]>
>> ---
>> kernel/irq/affinity.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
>> index f7ff8919dc9b..d2d01565d2ec 100644
>> --- a/kernel/irq/affinity.c
>> +++ b/kernel/irq/affinity.c
>> @@ -269,8 +269,9 @@ static int __irq_build_affinity_masks(unsigned int startvec,
>> */
>> if (numvecs <= nodes) {
>> for_each_node_mask(n, nodemsk) {
>> + cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]);
>> cpumask_or(&masks[curvec].mask, &masks[curvec].mask,
>> - node_to_cpumask[n]);
>> + nmsk);
>> if (++curvec == last_affv)
>> curvec = firstvec;
>> }
>> --
>> 2.27.0
>>
> --
> Ming

Could you pick this patch up?

Thanks,
Rei