From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E829C0755A for ; Mon, 27 Nov 2023 18:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229541AbjK0SHa (ORCPT ); Mon, 27 Nov 2023 13:07:30 -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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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