Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1739521rdb; Thu, 7 Dec 2023 07:35:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXOiz1ODwX5Spi87i5b9ot77i1LKdQ7ZPCbz9A/CS0/sE7HV8nRy7TS22H+a1gxFavfO9H X-Received: by 2002:a05:6a20:5482:b0:18f:d8b3:d926 with SMTP id i2-20020a056a20548200b0018fd8b3d926mr2391709pzk.91.1701963347408; Thu, 07 Dec 2023 07:35:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701963347; cv=none; d=google.com; s=arc-20160816; b=uVWKK1ZNGEaRD3XCBQyPq2CZelsthAsFx+h2TiUjMjN812UPAhdMpdYFXBXRV2BcOb Edp+ijKI8OGYkZlo2T3D32b7OEXf3yWmKPE3xGHmrL8HEeD+ey7EdVeaWynj8aukT8h1 cFpPX8ymT9V7mxmYA0D3raO2CygiX6dRaz/cknhQvqSsioVfCt5st4JuCHB0D0tV4FVM OGe7z8sVbhDXgJhRTCWayJr54brefb56NQ4nhjVHUVwyKw4nEGN6VTwLXFLAEFEzUUHT ibhJUkFZBV9r8qusQEDrcytm/9NLPmHiGcINBGfz3XUKtnIRR4SgAIrX5gUiNyDD2kW4 ONzA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=DQ9zPHpr/ko1PwAcJz/doWLGh25KaWRUhURJbDVaVls=; fh=v69VnqqMwJ+0FbOnFEBo6POn6bgnTVenb7+x/6f09Nk=; b=NDZ8m5MquXT2MNr66q9k7SwiASAGaUVJmqaa+CTsRQSsRdjQd0pi4J6ALW8vPbp8Jy YS08yC/7LCSQIjPQ/JaPwc6lH3Ud3skrt7lXcP+xr44n4KvZm1hxcUHaJTIEczRaamr3 p1eieBddtnHut+oWd0ycOl0jASH0qo0liktG9DMJIE8c/lcLr4V2ZtR48ELRf2W5oi0K 0XbInzylHp9QS9EkGJ7yrvRhaWIzFUDhbJVkbwCqUtYlLxexZ/RqqRhNOBuLTAGCcS/o uGt+ks9vcbI+0aAtJonyleuRmGblWbLpM6+bagRwqjP/e66n2BP4XjspMClh4xYN4N5o AEWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e3-20020a654783000000b005c1b2d279f3si1337600pgs.342.2023.12.07.07.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 07:35:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1C8CF8051CB1; Thu, 7 Dec 2023 07:35:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443507AbjLGPfD (ORCPT + 99 others); Thu, 7 Dec 2023 10:35:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443494AbjLGPfB (ORCPT ); Thu, 7 Dec 2023 10:35:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B69210E3 for ; Thu, 7 Dec 2023 07:35:07 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1192FC433C7; Thu, 7 Dec 2023 15:35:05 +0000 (UTC) Date: Thu, 7 Dec 2023 10:35:36 -0500 From: Steven Rostedt To: Yuanhan Zhang Cc: Sebastian Andrzej Siewior , zyhtheonly@yeah.net, tglx@linutronix.de, mingo@redhat.com, Venkatesh Pallipadi , peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com Subject: Re: [PATCH v3] sched/cputime: let ktimers align with ksoftirqd in accounting CPUTIME_SOFTIRQ Message-ID: <20231207103536.30ae05aa@gandalf.local.home> In-Reply-To: References: <20231201073240.T9bFNCkU@linutronix.de> <20231201080522.GA31309@didi-ThinkCentre-M930t-N000> <20231201161640.Z0cJLUi3@linutronix.de> <20231205153146.OSpCIs1G@linutronix.de> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 07 Dec 2023 07:35:31 -0800 (PST) On Thu, 7 Dec 2023 18:43:47 +0800 Yuanhan Zhang wrote: > It results in if we do not handle ksoftirqd like this, we will have a > bigger SYSTEM and less SOFTIRQ. And honestly that's what we want. Interrupts and softirqs that execute in interrupts and softirq context take away from the system. That is, if they are not explicitly blocked (local_irq_disable/local_bh_disable) they interrupt the current task and take up the time of the current task. We need to differentiate this because this context has no "task" context to measure. We do not want to add ksoftirqd or threaded interrupt handlers / softirqs to this measurement. Sure, they are handling interrupt and softirq code, but they have their own context that can be measured like any other task. If we blur this with real irqs and softirqs, then we will not know what those real irqs and softirqs are measuring. > So my point is if we do not align ktimers, ktimers would act like > **observation on *not-excluded ksoftirq patched* kernel** part in the > above example, > and this might make SOFTIRQ less than expected, /proc/stat less accurate. No it does not. When a softirq kicks off it's work to a thread (ksoftirq, threaded softirqd, or simply a workqueue), it's no longer running in softirq context, and should not be measured as such. The measurement is not about how much work the softirq is doing (otherwise we need to add workqueues started by softirqs too), it's about measuring the actual irq and softirq context. In PREEMPT_RT, we try to eliminate that context as much as possible. So seeing less is a feature not a bug! -- Steve