Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2216431rdb; Fri, 8 Dec 2023 01:26:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEpbFCMnbtJ3RFR6N40L/AWQG9aeAqnKxHcBAGgJfYMfa/3cD5j/VxJGxr4kwsLEB0QCRT X-Received: by 2002:a17:90b:3a87:b0:27c:f48e:e245 with SMTP id om7-20020a17090b3a8700b0027cf48ee245mr4150645pjb.24.1702027594067; Fri, 08 Dec 2023 01:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702027594; cv=none; d=google.com; s=arc-20160816; b=ejAZj5rtPPGoaQTEtaw66p7HAeptfg8kwUXa3CQ015pfRA8HdB2hUKCqzk+5OWzuTG mp4XIpXiefbk4F9bCcpgmbhgGCIgwcRKYgIJZS2CVDH9/UVdYArP3NjH4nE1NrN5rwqs EUVe+fFiZLRHPQXZLtsLd1hkZgkJ7bO2/OLviAMGpnGogGEJna9KlNjkUvDes8xCodbk TI+mrjIh7BwfkAjywmfYHf3q9eMKh99NLZ3drTPm6MxpcI7t6keblIhsJ25/8yOcKlh8 RRo4cfAhM4ScMXjccWqOloncfE9p+aarTpvdLZi4RVNzyNGRErQX+Tte2GCRsGuCYwtd We5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=4DgOoWa1HB6dItdgWMHpAy3z8gYpOLje3P7y/CYa1bw=; fh=A99gpFy5W2SF11fv6y6Y0k2GI2IFYWKkdV0KsWy7pcQ=; b=e768tQKhuMRaQMq4NqfQ6j9Qu1Le8P6mczLyWCTI/8Szul7Yq2soc9LsubHolwijzx PiBTtMVHoIMRIdFKRxvS764EPSh1ERIeL+rVPyMLNntAvWVSX0N8i+VX3SiU6nXXmdfQ ScU7oPlNnQ1Ep8SLs6eZRi6QaFgAKXyLqP9T+PIa2+ZZODSP6wBZ5/ejOz31gcMW7keO cfpZyHlmAy2U4N+Po0y5Us3eMYfzhCC/GpmQjJ/W7fxpAtR3Ah48+wZ76bO5j7C9h9+M zmUx7IF9dw2ETtIeenldo6LM23zFintkJF5DfrOy4lD6x2tNq2k43oZHefWP+QWz0XxT ty5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oqwRe8gN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id gv1-20020a17090b11c100b00286cd18da88si2642206pjb.137.2023.12.08.01.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 01:26:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oqwRe8gN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 7ED9C82A7E22; Fri, 8 Dec 2023 01:26:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233286AbjLHJ0P (ORCPT + 99 others); Fri, 8 Dec 2023 04:26:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233238AbjLHJ0N (ORCPT ); Fri, 8 Dec 2023 04:26:13 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD401724 for ; Fri, 8 Dec 2023 01:26:19 -0800 (PST) Date: Fri, 8 Dec 2023 10:26:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1702027577; 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=4DgOoWa1HB6dItdgWMHpAy3z8gYpOLje3P7y/CYa1bw=; b=oqwRe8gNbpLeoXtX/+zD76UmRJlsoiWnOpajQWHr3GGOh1SlQo1cVL+bxNejnVul9XMIQ9 UhQZIT2EhjvoBhzgeswXPvwcpA52hYJ3QMXmMVerHRh0q3Lx9J2LHCuhxPyKQUD78qbgy5 YHjhV7DtwObg1vxbhCX+p2EcrMCe6csSMVdagOL6ieueoVWCR64S1irNJBWzdMaMZ3oljF XRzKxNK0xpoxR94+y7kwqIxedRDwWG0GTBmsrKW26NpjmI6U7wVwE+QB8/wP38w7a1ZlBa lvl68aekoLRtAfyyDfQWwEzALAKzMBCD6BjIoHtNmsS/zmlDtdgFcMkoxpaY9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1702027577; 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=4DgOoWa1HB6dItdgWMHpAy3z8gYpOLje3P7y/CYa1bw=; b=S189MftGDiVPnT8XycZFbbRpOZOl/SLnlYKKqLOinskSMhtIL8JWQGBuUdRlZWgWc89DTS tooQ/nECYpQzfQCg== From: Sebastian Andrzej Siewior To: Steven Rostedt Cc: Yuanhan Zhang , 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: <20231208092616.LcwLlOyE@linutronix.de> References: <20231201073240.T9bFNCkU@linutronix.de> <20231201080522.GA31309@didi-ThinkCentre-M930t-N000> <20231201161640.Z0cJLUi3@linutronix.de> <20231205153146.OSpCIs1G@linutronix.de> <20231207103536.30ae05aa@gandalf.local.home> <20231207131811.08145840@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231207131811.08145840@gandalf.local.home> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 pete.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 (pete.vger.email [0.0.0.0]); Fri, 08 Dec 2023 01:26:31 -0800 (PST) On 2023-12-07 13:18:11 [-0500], Steven Rostedt wrote: > On Thu, 7 Dec 2023 12:19:28 -0500 > Yuanhan Zhang wrote: > > In irqtime_account_process_tick() there's: > > if (this_cpu_ksoftirqd() == p) { > /* > * ksoftirqd time do not get accounted in cpu_softirq_time. > * So, we have to handle it separately here. > * Also, p->stime needs to be updated for ksoftirqd. > */ > account_system_index_time(p, cputime, CPUTIME_SOFTIRQ); > > Which to me looks like it is counting ksoftirqd for SOFTIRQ time. But > honestly, why do we care about that? What's the difference if ksoftirqd > were to run or softirqd were to pass work off to a workqueue? > > ksoftirqd runs in vanilla Linux as SCHED_OTHER. The work it does doesn't > interrupt processes any more than any other kernel thread. I don't know why > we make it "special". The special part is that it runs with disabled preemption the whole time and the scheduler can't do a thing about it. This is different on PREEMPT_RT where the softirq is preemptible and scheduler can replace it with another task if suited. It still runs as SCHED_OTHER. The ktimers/ thread runs as SCHED_FIFO 1. So accounting it (incl. ksoftirqd) on SYSTEM is fine IMHO. > I guess the better question I need to ask is, what is this information used > for? I thought it was how much time was take away from tasks. As current > would be a task, and we do care if a real softirq is running, as we do not > want to add that to the current task accounting. > > But for ksoftirqd, that's not the case, and I don't really care if it's > running a softirq or not. As that time isn't interrupting actual tasks. Not > to mention, one could simply look at the ksoftirqd tasks to see how much > time they take up. The original argument was to have the softirq counters right in /proc/stat. This is what I remember from the trip to the museum. > -- Steve Sebastian