Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2468338pxb; Fri, 29 Oct 2021 01:54:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIrzCF1WcdlMuDhB04nHRBIJFeJc5g7PfGUEuccRkE6FPvoHa4IrOjXRezSsoIyJ39rEVp X-Received: by 2002:a63:7010:: with SMTP id l16mr7283215pgc.32.1635497688436; Fri, 29 Oct 2021 01:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635497688; cv=none; d=google.com; s=arc-20160816; b=dNK15EPDyvvnGXx1Yrrm2BNtcysFzM7tfPuqUwQNr43KwAi1zjVTe7p1aG3ex2nJIb m97/Th3qefjMO/wsR7du8Q3C5dy6CntGbirZV6k0Oim3jGReFUU8Xg6TOvR/indPsbQP OCjJSMX3V7IPw4iSgIOxoIWNVx3zJovkGzuvg1qlegEOcPYUgTAocTgNrOhbrnoWIvyw yctS9fE6Zc6rRZrXniUJ/u0MugaCHgQRJtkRmyqW28YvCwQrsxmdonVDIKrL4aLaQAm1 x/2CVKKeA/UNYZsWDdbtwR3dZFlVSBmhmd8A9j02ppolDfI2n+ydsbkuo3e1eqIjAFCo GLLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr; bh=5Z481sKrdI+bqtKLu8T4rT/uZYDCUKiGx1oVcZTbZvE=; b=WQuSq9iAzMyb6h22KLaPYPAVhtbJnnQvyELDHRDTOpDqVqe9m4u9NhNS4I69wN2al6 iSMvi8aBL1fO9aZab7uXeN7zAISuTKURgCXO5H9C2XVwUCvFEquz9DCTDims//FeuPad T4Ub1IPUvVE8mG2KxE0nhxcNCjxsRmCYqUQcwL70LVvGGj9SxkqxY3c8jzCOM7jVXU/Z ElR+Y8OiMK+wodqJrU7tP7qFqf73V1TbfNs50jJOvxshKWCe4t754CaFLavPtIzmWVly tP+RMeSoaEBwN2Fq59q2kMWOVfsqURUn2jzju9O64gp/ZJrbgEBHYDc8mYLXn/VNzX2h 2X8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si964445plc.173.2021.10.29.01.54.35; Fri, 29 Oct 2021 01:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbhJ2IyK (ORCPT + 99 others); Fri, 29 Oct 2021 04:54:10 -0400 Received: from esa9.hc1455-7.c3s2.iphmx.com ([139.138.36.223]:31793 "EHLO esa9.hc1455-7.c3s2.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbhJ2IyJ (ORCPT ); Fri, 29 Oct 2021 04:54:09 -0400 X-Greylist: delayed 430 seconds by postgrey-1.27 at vger.kernel.org; Fri, 29 Oct 2021 04:54:09 EDT IronPort-SDR: Al2z8rGmCsGEDN/Rl6+Zv2XmBLQfMJC7MusWZg4QAeJ/r7FNrNbUUglgrBV5eCqTdWRKR+3qUs OrCRK7asx5Er3HzlW66wvZW/gpAz7a2H5y6+YtNOvpJIQcxDGz0/t3+kng3AoppOapiqyFkaWs 8vpcOyJGH7w+fA39ufxZZ6ul9fmceF6o03IdZ4+NUBo9oL72sxPl6DpbabaoaeERQEZNEsX7B3 PioKcVTiwYEuVXI6R/biSbQWq/1WAo8UjeoQtCCsvdhIybe5SJGJAY7pf/CxM5VWq8KwW1IKfP ykOmcTuZuzzftkLaesfEfLwn X-IronPort-AV: E=McAfee;i="6200,9189,10151"; a="38593036" X-IronPort-AV: E=Sophos;i="5.87,192,1631545200"; d="scan'208";a="38593036" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa9.hc1455-7.c3s2.iphmx.com with ESMTP; 29 Oct 2021 17:44:28 +0900 Received: from oym-m3.gw.nic.fujitsu.com (oym-nat-oym-m3.gw.nic.fujitsu.com [192.168.87.60]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 73AE7EDC14 for ; Fri, 29 Oct 2021 17:44:27 +0900 (JST) Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by oym-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id A8B9DD9609 for ; Fri, 29 Oct 2021 17:44:26 +0900 (JST) Received: from localhost.localdomain (unknown [10.125.5.220]) by m3051.s.css.fujitsu.com (Postfix) with ESMTP id 7829385; Fri, 29 Oct 2021 17:44:26 +0900 (JST) From: Rei Yamamoto To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, yamamoto.rei@jp.fujitsu.com Subject: [PATCH] irq: consider cpus on nodes are unbalanced Date: Fri, 29 Oct 2021 17:27:30 +0900 Message-Id: <20211029082730.6728-1-yamamoto.rei@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; } -- 2.27.0