Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp62124lql; Fri, 12 Apr 2024 04:00:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXnADFGHcTFC5zoiP68SU0lCbqOsYOr6PqLTL9irPcbXoB/k+0agi5iLBLGAekUDQLuKCUdS3jjAJH9C/hNUF8dcgLFRQCiWqKBxb9Jeg== X-Google-Smtp-Source: AGHT+IHPJcDUOZkmuZcPQ9Bu8SU6tjmemAjGV3SZ0SGPL0xmSzaeDvcQzCzEaUlBWPBXWmq5WRwk X-Received: by 2002:a05:622a:653:b0:434:eff8:503 with SMTP id a19-20020a05622a065300b00434eff80503mr2775517qtb.61.1712919610250; Fri, 12 Apr 2024 04:00:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712919610; cv=pass; d=google.com; s=arc-20160816; b=knSRjt8b/yHRJA9VCkWsEa24Bwlp5yonHhMAXq+OsrCdSKTkzl+Zy5nfV9NSMH7Jsc k1zXKNzSeeBcEon4iBPQEowPp4bchP4GYaWbe+rROz4VgXMqlvTj3r7UUUbi2jd0v0jN hfyZ8SXmzEbVv03vXg5J1amlnjrUlAMUSbumbX6Yhy4JsqRFTtD4Wk1ywDJWU3hwHFij j+UHAZLVcUByEGEDHTlsSOmGQ7UM18fAiRfFHrDpnfS5Qc8MZ7u+DCKEx9Tr3/HMyEfA 1HIEce0+smlwnwqVC/DxYkx6784VBgILVLM0l5BQgPelWyzbvMTVvO+SSjvuZLmPApvs KyxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=zfc4u8X7q89BQjCnjUl6mrUZv4OF70NLbuatVjpKv7s=; fh=6IJpMDTtnaUF/prfdx4BgoVnDsfGpssO00kDvv705Zs=; b=ZJhgkGpS5jTIpAQymSVutchsnSvHNEyzLV2o8lkB61GbAQH/mSaBiSh6c6NnX4hq2+ 5QZ1FKh/KphI/3gLQ4xPwDjcFUsFYTN/PNfW1u0pKW+62UadIIl2QIT6MfjbQVha0Glk Hlgo/g82Eipi2lSEv3MOt/nbD2opGgW2ezozcwmCu0VCS0m841XDy6zQWWrGQRsxEa5h wWmD/VF3FrPDkwhOOHwHMuTzSpS0LtYzn6DtvrfRQVw6IZ6+kazZxG4yzXTaXO4Qwu54 i4XRU1Gl4KortNddTB353Cj8VuRWRyIMauLw834vqHGApUGx0KQL/NUymYLG6iLPZWVt PxGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=shingroup.cn dmarc=pass fromdomain=shingroup.cn); spf=pass (google.com: domain of linux-kernel+bounces-142541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142541-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h17-20020ac85851000000b004313be34033si3356696qth.719.2024.04.12.04.00.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 04:00:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=shingroup.cn dmarc=pass fromdomain=shingroup.cn); spf=pass (google.com: domain of linux-kernel+bounces-142541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142541-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 003041C23351 for ; Fri, 12 Apr 2024 11:00:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 907A355783; Fri, 12 Apr 2024 10:59:32 +0000 (UTC) Received: from bg1.exmail.qq.com (bg1.exmail.qq.com [114.132.67.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B318B5491B for ; Fri, 12 Apr 2024 10:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.132.67.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712919572; cv=none; b=Mw4MS/LeSvx9avKtv0lItPX8s3hju6/bfzPFgm3BepinatUKFAoERtqSPaToVXhp38T8x9muzoN3E/FPgghIZJfflksui+KMcR2hJF6p4es5UUhHcm0cjPUZaO9htsNrEdv7sbltNkPPtc7Vt05Ws/4i/ChCLnYdEkwkI4KS0TA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712919572; c=relaxed/simple; bh=89OWL6oKQL9eoj0BTb0SEH2HgmwDSvtWGUqC2G83MKw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ueqPK0YCwF0cwzumd1llzmZ93fauA2GTfWHslPCeBDqlzVhkg8srsLP/yjAcaNR/BAnZq14XJjju5Ruy6H96WkCXwVjzngqquYDt6DIc0fy06RxswYLHKL2QRwc/3vylqknZbDYyyAb49Zz2pftMl1StmUq5ngv4VjiII93KDi0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn; spf=pass smtp.mailfrom=shingroup.cn; arc=none smtp.client-ip=114.132.67.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shingroup.cn X-QQ-mid: bizesmtp82t1712919548twkgcxfw X-QQ-Originating-IP: cTu8bWC6MQj9EpB/V8OFtgVpRbN3pOE3oBFgWv0OihE= Received: from localhost ( [112.0.147.129]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 12 Apr 2024 18:59:07 +0800 (CST) X-QQ-SSF: 01400000000000903000000A0000000 X-QQ-FEAT: RrZlkntZBfmamcRyuPfoyReZ1wjERGVK+iTPLZgwTojoaJ8M98IfPlIFJMjVP VYRr+4hX1twh8sTPH2sdFyggPmEN+vCMbfTm885aXD4a0kazTTdZYBVaqTzVPWzQjWxSMr6 tCkKOIki8KkWyQ9eYJ2d8gea8uBIcX/IUNMf/u+IQXQfpKUE6vfLkoChCJsH7k/9uL4QT0J Z75YR/YFWJ+oXLNuCiW0O2eAOQ5VqElPIbxPzTV7WHPkLDlqxNMtQu7hqYuJaMi6LanxywJ 0TIyujtEQGZqknhgAQe+VVYCrZ4uw81UkVBi5/SnpkjpuTZjZJoTlx+G+4M4mpBi0dKvBag cF1YgsBIFhCt/9yMwPcmTmA8Jy7W3LkIz+uhphaycwLywOD4OaZxcUwn1byriJ1sykK+kaU NQqNqjmjqCcRVKAl3Nr9oVLLRH4ebc+y X-QQ-GoodBg: 2 X-BIZMAIL-ID: 11251082261756714604 From: Dawei Li To: tglx@linutronix.de, yury.norov@gmail.com Cc: akpm@linux-foundation.org, maz@kernel.org, florian.fainelli@broadcom.com, chenhuacai@kernel.org, jiaxun.yang@flygoat.com, anup@brainfault.org, palmer@dabbelt.com, samuel.holland@sifive.com, linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org, Dawei Li Subject: [PATCH 2/6] irqchip/irq-bcm6345-l1: Avoid explicit cpumask allocation on stack Date: Fri, 12 Apr 2024 18:58:35 +0800 Message-Id: <20240412105839.2896281-3-dawei.li@shingroup.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240412105839.2896281-1-dawei.li@shingroup.cn> References: <20240412105839.2896281-1-dawei.li@shingroup.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:shingroup.cn:qybglogicsvrgz:qybglogicsvrgz5a-1 In general it's preferable to avoid placing cpumasks on the stack, as for large values of NR_CPUS these can consume significant amounts of stack space and make stack overflows more likely. Use cpumask_first_and_and() to avoid the need for a temporary cpumask on the stack. Signed-off-by: Dawei Li --- drivers/irqchip/irq-bcm6345-l1.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c index eb02d203c963..6df37957b39c 100644 --- a/drivers/irqchip/irq-bcm6345-l1.c +++ b/drivers/irqchip/irq-bcm6345-l1.c @@ -192,14 +192,11 @@ static int bcm6345_l1_set_affinity(struct irq_data *d, u32 mask = BIT(d->hwirq % IRQS_PER_WORD); unsigned int old_cpu = cpu_for_irq(intc, d); unsigned int new_cpu; - struct cpumask valid; unsigned long flags; bool enabled; - if (!cpumask_and(&valid, &intc->cpumask, dest)) - return -EINVAL; - - new_cpu = cpumask_any_and(&valid, cpu_online_mask); + new_cpu = cpumask_first_and_and(&intc->cpumask, dest, + cpu_online_mask); if (new_cpu >= nr_cpu_ids) return -EINVAL; -- 2.27.0