Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3280443rdh; Mon, 27 Nov 2023 10:08:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMiHzrrx3H9UFI4GWS6Yp5Fr8yuk/uJ5Pz3tRLq5ZLcWBm/2ojbXcbPicLNeA0WsoAn20k X-Received: by 2002:a05:6870:5490:b0:1fa:2fbc:5906 with SMTP id f16-20020a056870549000b001fa2fbc5906mr8676594oan.42.1701108482330; Mon, 27 Nov 2023 10:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701108482; cv=none; d=google.com; s=arc-20160816; b=W5GEsTwOM9km4Vc3rInI1frauUn1h1PF8OSuvf1IMupXlkHEc8vn9IRJJBGwACz7+V thJYZxpTjT3s3p7yJrux9zlaiUy1q3vCnJHp3feWiQOfT7w1Dn9IQBV1JqaWC4VREh4a OQqh5nvPAm0rliemtdISWPa8t0O2bKb1I0LVro/1GuF16PHVpN7gs1ZirCbqXeCWWPrT pXZ3NrWn7uU8YEE12fACf5WR4fFJV47bEvPcOgRs77WMrs5SmOk0si57X8Jkpg65DMcR gCD1r1YCn97Tfz6ETEIIUwE/SphiobgfkU4FZgAePgqQmRM5qTIbQIholINRkGNJ85Vk MPdg== 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=dVM3DMwedfF2YeOpju5SxGlzQB99ISPQGf0DCZF3vsQ=; fh=S7bqgtAWajAu5u8EskexkDjvEQkfa/nWPrbIKDpOKaU=; b=urCAIPmXsTLX8PNRw/mm09hzr9AS3WVyqxqPR7IKgOsCW6fc4Sm0E2lF5ILN1llp3k 6IkQtoKRse7Jw8MQKs36J1wnBSz0c639R1QZTXncQIx2Vq4kOauBFJv4ZF1mlYwCsivA EM1UaQ+NAIRbBjvc2wfQsYLPfQ4ebgaemJnq0BZ0sV7+CNgFNghwgM27W5uD2b1A9iUD PLEOXkTXTZdLqfiykh5qwbAnymLF/R2041h82blWSNZkYUwxUPiB3wdqukvwXErAavsa k1+wACiQWDjsVMEs0WJDe+Imrv4uuY4X/N5LL4vtOvUPE9tQwQ20fiXQNPhho5jybz/W yG8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g13-20020a056870c38d00b001f5ad7e51a0si3979982oao.265.2023.11.27.10.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 10:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 C34E28062DC4; Mon, 27 Nov 2023 10:07:58 -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 S230293AbjK0SH3 (ORCPT + 99 others); Mon, 27 Nov 2023 13:07:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbjK0SH2 (ORCPT ); Mon, 27 Nov 2023 13:07:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCEBB1A5 for ; Mon, 27 Nov 2023 10:07:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07642C433C9; Mon, 27 Nov 2023 18:07:32 +0000 (UTC) Date: Mon, 27 Nov 2023 13:07:54 -0500 From: Steven Rostedt To: tiozhang Cc: , , , , , , , , , , , , , Subject: Re: [PATCH] sched/cputime: exclude ktimer threads in irqtime_account_irq Message-ID: <20231127130754.3affb908@gandalf.local.home> In-Reply-To: <20231124063450.GA18089@didi-ThinkCentre-M930t-N000> References: <20231124063450.GA18089@didi-ThinkCentre-M930t-N000> 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]); Mon, 27 Nov 2023 10:07:58 -0800 (PST) On Fri, 24 Nov 2023 14:34:50 +0800 tiozhang wrote: > diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c > index af7952f12e6c..0fac0109d151 100644 > --- a/kernel/sched/cputime.c > +++ b/kernel/sched/cputime.c > @@ -73,7 +73,12 @@ void irqtime_account_irq(struct task_struct *curr, unsigned int offset) > */ > if (pc & HARDIRQ_MASK) > irqtime_account_delta(irqtime, delta, CPUTIME_IRQ); > +#ifdef CONFIG_PREEMPT_RT > + else if ((pc & SOFTIRQ_OFFSET) && curr != this_cpu_ksoftirqd() > + && curr != this_cpu_ktimers()) > +#else > else if ((pc & SOFTIRQ_OFFSET) && curr != this_cpu_ksoftirqd()) > +#endif > irqtime_account_delta(irqtime, delta, CPUTIME_SOFTIRQ); > } If the above is necessary, it would look nicer as: else if (((pc & SOFTIRQ_OFFSET) && curr != this_cpu_ksoftirqd() && (!IS_ENABLED(CONFIG_PREEMPT_RT) || curr != this_cpu_ktimers())) -- Steve