public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Rei Yamamoto <yamamoto.rei@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, yamamoto.rei@jp.fujitsu.com,
	Ming Lei <ming.lei@redhat.com>, Christoph Hellwig <hch@lst.de>,
	Marc Zyngier <maz@kernel.org>, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH] irq: consider cpus on nodes are unbalanced
Date: Wed, 24 Nov 2021 20:33:49 +0100	[thread overview]
Message-ID: <878rxdl55u.ffs@tglx> (raw)
In-Reply-To: <20211029082730.6728-1-yamamoto.rei@jp.fujitsu.com>

Rei,

On Fri, Oct 29 2021 at 17:27, Rei Yamamoto wrote:

Cc'ing a few people who worked on this code.

> 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 2 problems caused by the difference of the
> number of nodes:
>
>  - If some unused vectors remain after building masks for present cpus,
>    remained vectors are assigned for building masks for possible cpus.
>    Therefore "numvecs <= nodes" condition must be
>    "vecs_to_assign <= nodes_to_assign". Fix this problem by making this
>    condition appropriate.
>
>  - 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 | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
> index f7ff8919dc9b..1cdf89e5e2fb 100644
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -267,10 +267,16 @@ static int __irq_build_affinity_masks(unsigned int startvec,
>  	 * If the number of nodes in the mask is greater than or equal the
>  	 * number of vectors we just spread the vectors across the nodes.
>  	 */
> -	if (numvecs <= nodes) {
> +	if (numvecs - (curvec - firstvec) <= nodes) {
>  		for_each_node_mask(n, nodemsk) {
> +			unsigned int ncpus;
> +
> +			cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]);
> +			ncpus = cpumask_weight(nmsk);
> +			if (!ncpus)
> +				continue;
>  			cpumask_or(&masks[curvec].mask, &masks[curvec].mask,
> -				   node_to_cpumask[n]);
> +				   nmsk);
>  			if (++curvec == last_affv)
>  				curvec = firstvec;
>  		}

  reply	other threads:[~2021-11-24 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29  8:27 [PATCH] irq: consider cpus on nodes are unbalanced Rei Yamamoto
2021-11-24 19:33 ` Thomas Gleixner [this message]
2021-12-15  1:57   ` Rei Yamamoto
2021-12-15  4:33     ` Ming Lei
2021-12-17  2:48       ` Rei Yamamoto
2021-12-17  6:57         ` Ming Lei
2021-12-17  7:12           ` Rei Yamamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rxdl55u.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=yamamoto.rei@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox