All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] irq: consider cpus on nodes are unbalanced
@ 2021-12-17 10:44 Rei Yamamoto
  2021-12-17 12:04 ` Ming Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Rei Yamamoto @ 2021-12-17 10:44 UTC (permalink / raw)
  To: tglx; +Cc: hch, kbusch, linux-kernel, maz, ming.lei, yamamoto.rei

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 <yamamoto.rei@jp.fujitsu.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] irq: consider cpus on nodes are unbalanced
  2021-12-17 10:44 [PATCH v2] irq: consider cpus on nodes are unbalanced Rei Yamamoto
@ 2021-12-17 12:04 ` Ming Lei
  2022-01-14  1:58   ` Rei Yamamoto
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Lei @ 2021-12-17 12:04 UTC (permalink / raw)
  To: Rei Yamamoto; +Cc: tglx, hch, kbusch, linux-kernel, maz

On Fri, Dec 17, 2021 at 07:44:07PM +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 <yamamoto.rei@jp.fujitsu.com>
> ---
>  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;

Looks fine,

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] irq: consider cpus on nodes are unbalanced
  2021-12-17 12:04 ` Ming Lei
@ 2022-01-14  1:58   ` Rei Yamamoto
  0 siblings, 0 replies; 3+ messages in thread
From: Rei Yamamoto @ 2022-01-14  1:58 UTC (permalink / raw)
  To: tglx; +Cc: hch, kbusch, linux-kernel, maz, ming.lei, yamamoto.rei

On Fri, Dec 17, 2021 at 20:04, Ming Lei wrote:
> On Fri, Dec 17, 2021 at 07:44:07PM +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 <yamamoto.rei@jp.fujitsu.com>
>> ---
>>  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;
>
> Looks fine,
>
> Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thank you for your review.
Does anyone else have a comment?

Thanks,
Rei


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-14  2:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 10:44 [PATCH v2] irq: consider cpus on nodes are unbalanced Rei Yamamoto
2021-12-17 12:04 ` Ming Lei
2022-01-14  1:58   ` Rei Yamamoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.