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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8384C64E7A for ; Tue, 1 Dec 2020 11:34:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A7D1206A5 for ; Tue, 1 Dec 2020 11:34:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XOg8lkef"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YefYi6+M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730591AbgLALeJ (ORCPT ); Tue, 1 Dec 2020 06:34:09 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:54926 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730583AbgLALeI (ORCPT ); Tue, 1 Dec 2020 06:34:08 -0500 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606822406; 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=16F09l0ttCem7YxuM0QIDRctBo+tVKI4girmiDzsCN0=; b=XOg8lkefm1ilLSeGwkySgonnesJ8YSKTA8kavqsQz5yFaNlwK8VUCXVXA4TLS23wR0Qolr +lsC6dtdmRnRWIMI7/OJHg/U8TdyHiZE0XtqDjTReo1p5I8VCtre6G2t/Sir8QTKZqwSWr SwQjQbnS8dnC6NKRcBqGn7LICAdxwYlbCN5Epx141FPh5C7UFEJbrc3G9euS460Yk83GHr TPCtEU8CIHPVAeKCV1uuXwIAR8JWCEAMMExx5a0w53iD1hcbH/UDg7RqUCHGO5z8oXTB4z HJv6c71W1oWgGsQ412ox3MPuxXY+UQ1ytCkwVxpSxn/RF7a6HFFOojpnAnauwA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606822406; 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=16F09l0ttCem7YxuM0QIDRctBo+tVKI4girmiDzsCN0=; b=YefYi6+MNut8ffsL9oogVMmvDv9jX1c2WZaSFPMN0TMJcAnXOTIpOQMPvAtlvvt3+Od6YM XKKp7uEVAJxxC3Dg== To: Peter Zijlstra , Frederic Weisbecker Cc: LKML , Tony Luck , Vasily Gorbik , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Christian Borntraeger , Fenghua Yu , Heiko Carstens Subject: Re: [PATCH 4/5] irqtime: Move irqtime entry accounting after irq offset incrementation In-Reply-To: <20201201092011.GS2414@hirez.programming.kicks-ass.net> References: <20201201001226.65107-1-frederic@kernel.org> <20201201001226.65107-5-frederic@kernel.org> <20201201092011.GS2414@hirez.programming.kicks-ass.net> Date: Tue, 01 Dec 2020 12:33:26 +0100 Message-ID: <87im9lhibd.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 01 2020 at 10:20, Peter Zijlstra wrote: > On Tue, Dec 01, 2020 at 01:12:25AM +0100, Frederic Weisbecker wrote: > Why not something like: > > void irqtime_account_irq(struct task_struct *curr, unsigned int offset) > { > struct irqtime *irqtime = this_cpu_ptr(&cpu_irqtime); > unsigned int pc = preempt_count() - offset; > s64 delta; > int cpu; > > if (!sched_clock_irqtime) > return; > > cpu = smp_processor_id(); > delta = sched_clock_cpu(cpu) - irqtime->irq_start_time; > irqtime->irq_start_time += delta; > > /* > * We do not account for softirq time from ksoftirqd here. > * We want to continue accounting softirq time to ksoftirqd thread > * in that case, so as not to confuse scheduler with a special task > * that do not consume any time, but still wants to run. > */ > if (pc & HARDIRQ_MASK) > irqtime_account_delta(irqtime, delta, CPUTIME_IRQ); > else if ((pc & SOFTIRQ_OFFSET) && curr != this_cpu_ksoftirqd()) > irqtime_account_delta(irqtime, delta, CPUTIME_SOFTIRQ); > } Why not making all of this explicit instead of these conditionals? Thanks, tglx