Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp801896rdb; Thu, 22 Feb 2024 23:29:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1DURBeBNMa4ayT7I3zlOhQxrXIB0yf8V7a7sk1cbziVmBAukSdMk1qCFDBgD+aJYO3/VLXFRs3NGXdOczxdsFBvhI+l/EoKV5QnzuBg== X-Google-Smtp-Source: AGHT+IGyPtxS9I6TFtEHrXenPrjYvTOdN9cttogLS2IY1Fr+ElBmEUPsNC4XXcgo0ek/VPkg57Mg X-Received: by 2002:a17:906:164a:b0:a3e:6d75:61df with SMTP id n10-20020a170906164a00b00a3e6d7561dfmr683942ejd.45.1708673387332; Thu, 22 Feb 2024 23:29:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708673387; cv=pass; d=google.com; s=arc-20160816; b=Bph591v55A0epgnZKsz7z9bMswyw9YPG5wSyNBCoLb0ZNgNZF5xwlt+VpEBjb13Yw5 +R8mr9Vgz7yVZ0pH068jDEFS5otcxZ0FWrf3C+pQ/B1Qs1W8a/lnf9/FpvZRRvc9G7rv cW1k3ajdrg0cVwIyLo7o7yy+E23wMzP+U0gp/zEdnHrxvzgOjG5rcR5QcB6+M5uYANln Djywm6l3++fwXQN3OcsTkZ8KhAcMWbDdy/m0WVteapuOWRqGiUzrrLGN/sjpx0lRxYpI BnwIE7o7GqrHF3FX+1OBG163uZT+tDClw7Lh526jMGBhKwxCwUJaaoMQx15brlfyGaeG aBXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=HaA9fQcqVYSuNg3wkRSEZWU32RdGNi0Gngw0SdVL3to=; fh=2/ZrznIiu/6sRquCTVLENfH07TDmcULz/xg8KEr1Bak=; b=u5VYfmeO16Fxo0Tj2Ipt7V/dEvxaD/+Ns0uFt/5JCE+vhkPh4Lyt/Hc81XG2+HMVsz aTW6p5f/9g3ttAGl1K6V/tsdka4cc8sYayFu8QhUph9uXvBPEwwW8hpyPjDCJZIOcOPu CXsVZ6c6nTD3N+DW/xrsE1Mw6qpj38GzqPs7y0HYxMcd6KCEb+nccwOv2Qg+4mdU5ird 4NOdpq9Cv2e+pe4jEDGeaC3OegQdE6qkeGQLNWHS9F+Kg90pEd8yoe4ik9BN6XRjAX3W ukUkas4dzXt9lidCUIZZYQk5VLkAJBY4GpuXA2HVHp25P1Yi2AvqB0KbLQwFUCcy8hUv t44Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=birTqkb6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9ktyOyU9; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y10-20020a17090668ca00b00a3ece16f972si15667ejr.403.2024.02.22.23.29.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 23:29:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=birTqkb6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9ktyOyU9; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1BE321F22FCE for ; Fri, 23 Feb 2024 07:29:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3687214A8C; Fri, 23 Feb 2024 07:29:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="birTqkb6"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="9ktyOyU9" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 BA278BA2B; Fri, 23 Feb 2024 07:29:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708673381; cv=none; b=EDEzjRTNI8zICAbXKRzoX4xzbQydqliNdT4hjE9Us1An+Fu1b9AagTh8hJdhT8YtH+BvjmUeNsbiNIHcJIbYEI5ZP2JbjPy1eMNAytb459jMAmY4wA7sISuZgj2hT/PqRbMUOO9ytHWsJZD9EN85HBG7aRzJKNPGBMWMH1kgPzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708673381; c=relaxed/simple; bh=dNRL46Jwutz/7GkyTSOrgCg5PYJ/yxKiHilPIwmouxI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=eL4a6gj3kJnw63JSoKuIWK30kdo4F+me15E0Lzm5hnvZViVh7sJqjxR6WdS8k6mSOkdf8Y5sc88X2rqbuHv4gg6inJngCRJfmUtrW4gdkg8ONXNZSUUCm2kgeK0EHAEnR7DxDOohAUfPzlKlSej5nqLAQoKM3ni6Wc3Dncuyd2I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=birTqkb6; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=9ktyOyU9; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708673377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HaA9fQcqVYSuNg3wkRSEZWU32RdGNi0Gngw0SdVL3to=; b=birTqkb6S3mj0vdYA18Ur/BPk8EwAlE45/GWI5qRKle3zsNaENUwBMIPxhy/wf1e2BmKaL Al1pDVkOEK0bGEhW+VQFvi4D/Yp5kIRtjOBiHOC7qed8hpNgbjLEClDkbg4jADpSLFshaP w2/IwyY+MRrPD/Vf2HCnqkOjLgrwr54+QJ4Gj8OpsnsTvoCxP/cYJP1NVCscr0xJaPTbMu 6/QahWITN6d/C1GJ79JcTJAglZQSqpYxaDdXFMcUlZuMmTqutTUYy/47iOxfjWzJ4slKIi p6jeNKGJuyB6RzhCeSxqe2xUi4HESXponoDtpONSWF1bwOJEG7Eu7vxP3MombQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708673377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HaA9fQcqVYSuNg3wkRSEZWU32RdGNi0Gngw0SdVL3to=; b=9ktyOyU9vD7z+zHFv9WQ2D0q27MFF7CdOuldZ0azOdzfOrY5tHMJiYiRNDJd+k5uPPn9m6 pXpzIcrgwGPoA5CA== To: Bitao Hu , dianders@chromium.org, akpm@linux-foundation.org, liusong@linux.alibaba.com, pmladek@suse.com, kernelfans@gmail.com, deller@gmx.de, npiggin@gmail.com, tsbogend@alpha.franken.de, James.Bottomley@HansenPartnership.com, jan.kiszka@siemens.com Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, yaoma@linux.alibaba.com Subject: Re: [PATCHv9 2/3] irq: use a struct for the kstat_irqs in the interrupt descriptor In-Reply-To: <3f4b7dbe-93c1-4cb0-8233-18e8432409f8@linux.alibaba.com> References: <20240222093420.13956-1-yaoma@linux.alibaba.com> <20240222093420.13956-3-yaoma@linux.alibaba.com> <87jzmwfxak.ffs@tglx> <3f4b7dbe-93c1-4cb0-8233-18e8432409f8@linux.alibaba.com> Date: Fri, 23 Feb 2024 08:29:36 +0100 Message-ID: <87frxjeizj.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Fri, Feb 23 2024 at 15:18, Bitao Hu wrote: > On 2024/2/22 21:22, Thomas Gleixner wrote: >>> - if (desc->kstat_irqs) { >>> - for_each_online_cpu(j) >>> - any_count |= data_race(*per_cpu_ptr(desc->kstat_irqs, j)); >>> - } >>> + if (desc->kstat_irqs) >>> + any_count = data_race(desc->tot_count); >> >> This is an unrelated change and needs to be split out into a separate >> patch with a proper changelog which explains why this is equivalent. >> > > Alright, I will remove this change witch is not related to the purpose > of this patch. > > I guess that the purpose of suggesting this change in your V1 response > was to speedup the 'show_interrupts'. However, after reviewing the > usage of 'desc->tot_count' in 'unsigned int kstat_irqs(unsigned int > irq)', I think the change might be as follows: > > diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c > index 623b8136e9af..53b8d6edd7ac 100644 > --- a/kernel/irq/proc.c > +++ b/kernel/irq/proc.c > @@ -489,8 +489,13 @@ int show_interrupts(struct seq_file *p, void *v) > goto outsparse; > > if (desc->kstat_irqs) { > - for_each_online_cpu(j) > - any_count |= > data_race(per_cpu(desc->kstat_irqs->cnt, j)); > + if (!irq_settings_is_per_cpu_devid(desc) && > + !irq_settings_is_per_cpu(desc) && > + !irq_is_nmi(desc)) > + any_count = data_race(desc->tot_count); > + else > + for_each_online_cpu(j) > + any_count |= > data_race(per_cpu(desc->kstat_irqs->cnt, j)); > } > > if ((!desc->action || irq_desc_is_chained(desc)) && !any_count) > > Is my idea correct? Yes.